C # How to get all windows using MainWindowHandle

Take a look at this image: enter image description here

This is how I got the handle of a window enclosed in a black box.

Process[] processes = Process.GetProcessesByName("TopazChat"); foreach (Process p in processes) { MessageBox.Show(p.MainWindowHandle.ToString()); List<IntPtr> test = GetChildWindows(p.MainWindowHandle); foreach (IntPtr IGotIt in test) { MessageBox.Show("I got the child windows"); } } 

My question is: how do I get a window handle that has been closed by a red field? and is there something wrong with my approach?

any suggestions? I just use this approach because it is the only one that I know of.

+4
source share
1 answer

This is another window - this is another top-level window in the same process that implements one of the visible windows in the application. This is an old Delphi 7 application that implements a top-level hidden window outside the visible window hierarchy. This hidden window is what you found, highlighted in black, with the class name TApplication.

If I were you, I would p / call EnumWindows to get all the top-level windows that will include the visible main windows for this application. This will be implemented very similar to your GetChildWindows method.

+2
source

All Articles