Displaying Windows from the Taskbar

Started by
22 comments, last by Colin Jeanne 14 years, 11 months ago
Well now I am using the following algorith to find the correct windows:

 if((IsWindowVisible(DesktopName) == TRUE && GetParent(DesktopName) == NULL && GetWindowLongPtr(DesktopName, GWL_STYLE) & WS_CAPTION) 	 ||    ((GetWindowLongPtr(DesktopName, GWL_EXSTYLE) & WS_EX_APPWINDOW) && (GetWindowLongPtr(DesktopName, GWL_EXSTYLE) & !WS_EX_TOOLWINDOW))) { GetWindowText(DesktopName, WNDTitle, 100); SendMessage(DesktopsListLB, LB_ADDSTRING, NULL, (LPARAM)WNDTitle); }


What do you guys think? Anything missing from it?

Thanks :).
Advertisement
Hmm, that's a pretty confusing condition there... I'd probably split it out into a separate function just to make it clearer. Like so:

bool IsShowInTaskbar(HWND hwnd){   if (!IsWindowVisible(hwnd)) {      return false;   }   LONG exstyle = GetWindowLong(hwnd, GWL_EX_EXSTYLE);   if ((exstyle & WS_EX_APPWINDOW) != 0) {      // WS_EX_APPWINDOW windows are always in the taskbar      return true;   }   if ((exstyle & WS_EX_TOOLWINDOW) != 0) {      // WS_EX_TOOLWINDOW windows are never in the taskbar      return false;   }   // if it's not WS_EX_APPWINDOW or WS_EX_TOOLWINDOW, then it's in the   // taskbar if it's a top-level window   return (GetParent(hwnd) == NULL);}

Also, I don't believe you need to check the WS_CAPTION style. I don't think that has an effect.
Hehe, I just read to the bottom of the article I linked before, I gotta highlight the section on "Choosing window titles" because, even though it's not related to this topic, it's too awesome to pass up:



It seems even Microsoft software isn't above being named and shamed there! Too funny :-)
Alright then I'll remove the checking for the style "WS_CAPTION" :) I thought there was something wrong with it but couldn't be sure, it makes sense to remove it though; as some programs have a custom caption.

LOL! Yeah I noticed that before and laughed at it too :), "Windows Live Mess" haha. To be honest I'm quite suprised they used their own program as an example :P.

Well I believe this thread is pretty much RESOLVED. Thanks for all your help guys its been a pleasure ;).
Well actually there is one more problem, kind of. But it isn't acutally related to the thread and it doesn't deserve its own one so I'll just post here. Why is it that every control I create looks like the old versions from Windows 98 or something? I'm using Windows Vista currently. If you require a screenshot please let me know.

Thank you :).
You need to include a manifest with your executable so that it loads version 6 of the common control library. This page from MSDN describes the process of including one. It's a bit brief on the details, so if you need something more step-by-step, I'm sure you can google for one :-)
Oh my god! I can't believe they had to make it so complicated. I mean I thought I would only have to use a single function :P. Seriously though I'm kinda anoyyed... I've never even heard about using manifest files and am stil not sure what they are. Well thanks for the link my friend, it did give me somewhere to start :).

EDIT - Also, how would I add the manifest file to my project in Visual Studio? Or do I just put the manifest file in the same folder as my executable before compiling?

[Edited by - VirtualProgrammer on May 8, 2009 4:27:19 AM]
YES! I finally got the split button to show up :D, so I have to use manifest files for any new control that is past Windows 95? Also do I have to create a manifest file for every executable in my application (not that I have multiplae but I need to know)?
I'm really sorry guys but could someone please explain this all to me :(... I never even knew about manifest files before Codeka told me. Its just killing me inside now... because I would really like some information on the subject, information such as what are the uses for manifest files, how they work, and what is this "XML" format which they use (which looks suspiciously like HTML).

What's really annoying me is that I don't even know what to search in google, I tried "Visual styles" but it just results in forums telling you how to crack your "uxtheme.dll" file to use unsighned themes and what not... so could someone please tell me what to search?

Thanks! :).
This is the start page for the whole SxS technology. The reference link at the bottom leads to more goodies including documentation of the file format. They're basically MS's current favourite way of combatting DLL Hell with additional bits of metadata for UAC etc.

This topic is closed to new replies.

Advertisement