I have an Internet explorer page which generated a pop-up. I can get the parent from the pop-up window's handle:
>>> child.handle
15208472
>>> win32gui.GetParent(child.handle)
33230502
But I can't find the child's handle by using EnumChildWindows
:
>>> win32gui.EnumChildWindows(win32gui.GetParent(child.handle), lambda hwnd,p: child_handles.append(hwnd), None)
>>> len(child_handles)
39
>>> child.handle in child_handles
False
I've done this recursively as well (getting the children of all the children) and still no child handle to be found. Why might this be the case?
A popup window isn't a child window, so can't be enumerated with EnumChildWindows
.
When you called win32gui.GetParent
you actually got the "owner" window of the popup, but "owner" and "parent" are two different things. See the MSDN entry for more infromation.