Reputation: 4841
I'm quite new to the Windows API and I'm trying to find the handles of all the windows which appear in the taskbar.
So far, I have managed to:
I have tried getting all child windows of the desktop window, which gives me nearly 900 window handles! So I tried to filter them down, by getting only visible windows and only windows whose title is longer than 0 characters, but I'm still way off - with 68 windows??
So could some Win API expert enlighten me as to how you do this please :-)
and also possibly explain why there are so many windows?
Edit:
private static bool HasAppWindowStyle(IntPtr handle)
{
return (GetWindowLong(handle, GWL_EXSTYLE) & WS_EX_APPWINDOW) != 0;
}
Upvotes: 2
Views: 2916
Reputation: 101569
The exact algorithm is not documented, I came up with some pseudo code in this answer that does an ok job.
Upvotes: 1
Reputation: 941217
Top-level windows that you find with EnumWindows and have taskbar buttons will have the WS_VISIBLE and WS_EX_APPWINDOW style flags turned on.
Upvotes: 1
Reputation: 22555
Did you see FindWindowEx sample? Also you can filter them to have a text on it, I think the windows you are see is the Desctop items (I'm not sure) but remove some item from desktop and see the changes.
Upvotes: 2