Jump to content
  • Advertisement
Sign in to follow this  
VirtualProgrammer

Displaying Windows from the Taskbar

This topic is 3327 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well recently, for testing purposes I created a program that displays the programs that are in the task bar. Or so I tried. What I attempted to do was to use EnumWindows() to go through all the windows and list them in my list box. But I ended up with EVERY window (not child windows), for example invisible windows which are not displayed on the Taskbar. I then tried to filter the results by using IsWindowVisible() but I still ended up with windows that weren't on the Taskbar. So my question is, "How do I only list windows that are on the Taskbar in my list box? and not child, invisible or any other sort of window?". Thank you. EDIT - Please go down as the subject of the thread has been changed from "Displaying Windows from the Taskbar" to "Using 'Modern style' Controls", thank you :D. [Edited by - VirtualProgrammer on May 9, 2009 7:38:14 AM]

Share this post


Link to post
Share on other sites
Advertisement
Hmm, the example searches for the Task Bar and then sees the programs that are on it. That does partly answer my question, but what I need is the algorithm used by the Task Bar to find the correct windows to list. So basically, how is it that the Task Bar can tell what programs it needs to display? what method is used?

Thank you :).

Share this post


Link to post
Share on other sites
theTroll: Thanks but I'm not sure looking for that style will work :).
adeyblue: Hmm thanks :D Your method sure seems to work nicely! But since I didn't understand some of the functions that you used I decided to do 'it' using another method. And the following seems to work great!:

if(IsWindowVisible(DesktopName) == TRUE && GetParent(DesktopName) == NULL && GetWindowLongPtr(DesktopName, GWL_STYLE) & WS_CAPTION)
{

GetWindowText(DesktopName, WNDTitle, 100);

SendMessage(DesktopsListLB, LB_ADDSTRING, NULL, (LPARAM)WNDTitle);

}


Is there anything wrong with using this method? for example, certain windows that should be detected that won't be.

Thank you.

Share this post


Link to post
Share on other sites
I'm guessing DesktopName is the window handle you're testing? That's a really bad name for that variable if that's the case (it's not a "name" and it's not the "desktop" either, hwnd is a pretty standard variable name for miscellaneous window handles).

Anyway, you've also got to test for the WS_EX_APPWINDOW and WS_EX_TOOLWINDOW extended window styles. Basically, WS_EX_APPWINDOW windows will always appear in the taskbar, even if they have an owner, and WS_EX_TOOLWINDOW windows will not appear in the taskbar even if they don't have an owner.

See MSDN for more details.

Share this post


Link to post
Share on other sites
Oh haha, that variable naming thing you're talking about was kind of an accident. Basically I already had another one of my tests up and running (it was to do with desktops :)) so I just quickly changed it around to see how window enumerating works.

Oh so that's why I need to look for them. Alright let me just implement that and give you the resulting code. Just to see if it is a good algorithm to use :).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!