特定の IE インスタンスの子を取得して、ポップアップがあるかどうかを確認したいと考えています。
ウィンドウをポップアップする .html ページを作成しました。このバージョンの IE では常にそうであるように、ポップアップのタイトルは「Web ページからのメッセージ」です。
子ウィンドウから親を取得できます。
>>> child_handle = 15208472
>>> win32gui.GetWindowText(child_handle)
'Message from webpage'
>>> win32gui.GetParent(child_handle)
33230502
>>> parent_handle = 33230502
>>> win32gui.GetWindowText(parent_handle)
'pop-up example - Windows Internet Explorer'
ただし、親から子ウィンドウを取得できないようです:
>>> def all_ok(hwnd, param): return True
>>> win32.EnumChildWindows(parent_handle, all_ok, None)
>>>
どうしてこれなの?