Click to See Complete Forum and Search --> : EnumWindows API


opiston
December 2nd, 2006, 05:37 PM
Hi all,

I am trying to find the names of all the opened Windows.
I am using EnumWindows API, and I am at the point that I can print bunch of Window titles; however, it's printing much more than I wanted.

For example, I have winamp, visual stuido, 1 internet explore open. The program printed out the 3 things above, but it's also printing things like:

&File
&File
&File
&File
&File
AutoHide
AutoCompleteProxy
ccApp
etc
.
.
.

Am I using a wrong function for what I want to do?
Thanks,
opiston

zeRoau
December 2nd, 2006, 10:48 PM
Could you post some code please it could help.

The first thing that jumps into my head is to run a check on the following in your callback function.


if (!IsWindowVisible(hWnd))
return TRUE;

opiston
December 3rd, 2006, 01:53 AM
Hi zeRoau,

I put your code into the callback function and it's working as it should now.
Thank you for your help.

opiston

VladimirF
December 4th, 2006, 12:28 PM
...it's working as it should now...
Just a quick note - it DID work as it should in the first place, only you didn't know that EnumWindows enumerates hidden windows too... :)

opiston
December 5th, 2006, 10:19 PM
Hey VladimirF,

How's going?

Just a quick note - it DID work as it should in the first place, only you didn't know that EnumWindows enumerates hidden windows too... :)

Yeah, I thought EnumWindows only enumerate the visible windows. I guess I should have said, "It's working as I want it to" =))
Here is the definition of EnumWindows from MSDN:


The EnumWindows function enumerates all top-level windows on the screen by passing the handle to each window, in turn, to an application-defined callback function. EnumWindows continues until the last top-level window is enumerated or the callback function returns FALSE.

I guess I mis-understood top-level windows.
So what is top-level windows then?

Thank you,
opiston

VladimirF
December 6th, 2006, 12:01 PM
So what is top-level windows then?
Windows that have the Desktop Window as a parent