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.
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.