Reputation: 335
I have 2 windows with the same class and name. Here is a picture of the 2 windows in SPY++
I want to find the bottom window(001C1E1A
) But whenever I'm trying to find him using this line:
hwndChild2 = FindWindowEx((IntPtr)hwndChild, IntPtr.Zero, "msctls_progress32", null);
I get the top window(00790B50
) instead.
So my question is:
How can I find the bottom window(001C1E1A
) from the list in the picture?
Upvotes: 0
Views: 318
Reputation: 43876
According to documentation the first argument of FindWindowEx
is the parent window, and the second parameter is childAfter
, the handle of the window you found before.
So these calls should give you the result:
// find first window
hwndChild = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "msctls_progress32", null);
// find second window
hwndChild2 = FindWindowEx(IntPtr.Zero, (IntPtr)hwndChild, "msctls_progress32", null);
Upvotes: 3