Using pinvoke I can find Handle of a window with particular class & name easily:
[DllImport("user32.dll")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
IntPtr hWnd = FindWindow("Foo Class", "Foo Window");
The above code works perfect if there is only 0 or 1 matching windows. However the unmanaged application I am working with spans multiple windows. Calling FindWindow multiple times returns the same Window Handle each time.
What do I need to do to get ALL windows with particular class and name.
I will also accept answer for alternate solution the same goal. (I am thinking maybe it can be done by finding process ID of application and then getting all top level windows, and filtering for the ones needed).