Prev: Calling WIN32 API SetEntriesInAcl() always fails and returns the error code 1332.
Next: generating mouse clicks
From: Galbu on 12 Nov 2005 12:33
Hi all, is there any way to retrieve the hWnds of all the opened
windows? Plz help.. I'm getting crazy!!
From: David Jones on 12 Nov 2005 12:40
> Hi all, is there any way to retrieve the hWnds of all the opened
If all you want are top-level windows, use EnumWindows.
What do you need this for? If EnumWindows isn't what you want, a
better description of the problem will help us suggest an appropriate
> Plz help.. I'm getting crazy!!
I don't think we can help you with that. Seek professional help.
From: Galbu on 12 Nov 2005 15:34
I need to make something like the Windows' taskbar where all the
windows opened are listed.. so the top-level windows aren't enought..
but that's something
From: Kellie Fitton on 12 Nov 2005 17:50
You can work out this problem with a simple do-while loop, try
someThing like this:
Hope these information helps,
From: David Jones on 12 Nov 2005 21:53
> I need to make something like the Windows' taskbar where all the
> windows opened are listed.. so the top-level windows aren't enought..
> but that's something
Correct me if I'm wrong, but isn't the taskbar a list of all
If you really mean *all* windows (including all controls such as
edit boxes, static labels, and buttons and even including invisible
windows), you can use GetWindow like Kellie suggests, or you can
use EnumChildWindows. Is what you want similar to the Spy program
that's distributed with Visual Studio?
Your problem is still vague.... "all the windows opened" can mean
any of the following:
* top-level windows (visible in the taskbar)
* all popup windows (such as top-level + dialogs)
* all parent windows (such as windows that contain controls)
* all visible windows
* all windows in the system
Regardless, you're either going to need EnumWindows or
EnumChildWindows. It's either top-level or all, so if you need
something more than top-level, you need to filter out the ones
you want when you loop through all windows in the system. If
you state specifically what you want, we can recommend methods
of filtering out those windows, but right now I'm not sure what
BTW, you shouldn't really need GetTopWindow since it seems like
it's the same thing as GetWindow(..., GW_CHILD). Moreover, the
Get___ functions aren't as reliable as the Enum___ functions
according to MSDN, so I'd avoid GetWindow when you really want
to /enumerate/ windows. (Just my 2c - you can get it to work
either way, but with GetWindow you need to be more careful.)