I dug into this a little more, but I'm afraid there isn't much good news to share :(
> What I would like to achieve is the IWebBrowser2 object of the > dialog.htm page. I know I can access anything on the page itself via > the IHTMLDocument2 (which I already have) but that's not my need. I can reproduce this your problem. I also added ObjectFromLresult to pywin32 - so getting the doc object from a HWND will (in pywin32-212) be as easy as: # See KB Q249232 hwnd = win32gui.FindWindow('IEFrame', None) for child_class in ['TabWindowClass', 'Shell DocObject View', 'Internet Explorer_Server']: hwnd = win32gui.FindWindowEx(hwnd, 0, child_class, None) msg = win32gui.RegisterWindowMessage("WM_HTML_GETOBJECT") rc, result = win32gui.SendMessageTimeout(hwnd, msg, 0, 0, win32con.SMTO_ABORTIFHUNG, 1000) ob = pythoncom.ObjectFromLresult(result, pythoncom.IID_IDispatch, 0) doc = Dispatch(ob) doc.bgColor = "red" (The above is the simple case - I understand your example was more complex due to the modal dialog). But as you said, you are already at that point with ctypes, and we move into your problem. From the code above, pywin32 can take over - it already has native support for IServiceProvider - so, something like the following, from your failing sample. ihtmlwin = doc.parentWindow # ... the service provider ... pIServiceProvider = ihtmlwin._oleobj_.QueryInterface(pythoncom.IID_IServiceProvider) # ... and the IWebBrowser2: ie = pIServiceProvider.QueryService(IID_IWebBrowserApp, IID_IWebBrowserApp) And the problem I see is that QueryService *always* fail with E_NOINTERFACE, regardless of the interface requested as the second param. Even IUnknown fails, which doesn't make sense, so my conclusion is that the object is simply refusing to return that service (rather than failing to return the interface for the service). The docs imply IE should indeed work here, so I suspect the issue relates specifically to the modal window. I'm afraid I ran out of time on this issue to confirm the QueryService worked in the "normal" case - I just got far enough to ensure myself the problem wasn't related to Python ;) Hope your are progressing regardless ;) Cheers, Mark _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32