sfun28
asked on
get all Window Handles (hWND) associated with a Process
Hello Experts! I have a Process object and I'd like to get window handles (hWND) for all windows associated with that process (not just the Main Window). How would I do that in vb.net?
Are you talking about enumerating the child windows for the main Window handle?
ASKER
Actually, what I'm finding is that the main window handle returned by windows isn't the right one for the app/process in question. I'm using a Window spy program and it returns a different handle. Now here's the wierd part: the Main window handle can be used to do some UI automation, but its broken for most things. For example, I can minimze the window, but it minimizes to a rectangle just above the task bar (this is an old windows program). However, I can't interact with any of the controls whereas when I use the handle returned by the spy program, I can. So I figured if I just look around at the other window handles, I'd stumble on the same one that the spy program is returning. make sense?
ASKER
That was a long way of saying that I'm not sure if I'm looking for children or siblings. Because I don't know, I thought I'd just get all windows associated with a process, wherever they are in the hierarchy.
I know how to enumerate windows, but the missing part would be associating them with a process. The System.Diagnostics.Process class can get you the main window handle, but not the related windows that I know of.
ASKER
could you tell me how to enumerate all windows? maybe I can use other information to make the association (like titles, etc.)
also, could you tell me how to get all child windows of a main window handle?
also, could you tell me how to get all child windows of a main window handle?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks!
ASKER
thank you!