Win32 API FindWindow

Jun 7, 2010 at 8:14pm
Hi,

I have the following problems:

1)

I want to find all windows which have the following class: "class1" but i dont want to enumerate through ALL windows and select the ones that have the right class . Is this possible? ( i dont want to use callbacks)

For instance when i do:

int hwnd = FindWindow("class1",null)

It will find 1 window of the correct class. but when i call it again
it will just find the same window again. Another thing i tried
was:

int hwnd = FindWindow("class1",null)
int secondHwnd = User32.GetWindow(hwnd, GW_HWNDNEXT);

But this just gives me the next window, which is not the right class.


2) is it possible to only find visible windows? FindWindow also
finds non visible windows, but i am not interested in them.
Last edited on Jun 7, 2010 at 8:16pm
Jun 8, 2010 at 1:39am
Try to use the CreateToolhelp32Snapshot loop and find the processname you're looking for. Return the pid for that processname then, make another loop and find a process with the same processname BUT different pid. Return the pid of this process, that should be the window you are looking for.
Last edited on Jun 8, 2010 at 1:42am
Topic archived. No new replies allowed.