I\'m building an app that given another app mainWindowhandle it collects information about the window state. I have no problem collecting information about child windows, bu
public void GetWindowHandles()
{
List windowHandles = new List();
foreach (Process window in Process.GetProcesses())
{
window.Refresh();
if (window.MainWindowHandle != IntPtr.Zero)
{
windowHandles.Add(window.MainWindowHandle);
}
}
}
Read This as to why we call the refresh method and check if the pointer is zero