The information in this article applies to:
SYMPTOMSHosting the WebBrowser control in either a Visual Basic or Visual C++ application and calling its HWND property usually returns the following HRESULT of E_FAIL:
CAUSEThe HWND property is not a valid property of the WebBrowser control. RESOLUTIONWARNING: These techniques may not work for frame windows in future versions of Internet Explorer after 5.01. The advice that follows is only guaranteed to work for the top-level WebBrowser control.
Visual Basic developers can use the following code, which takes the HWND of the hosting form and examines all its children until it finds the window with a window class of HTML_InternetExplorer. This is the topmost window of the WebBrowser control. CAUTION: The Internet Explorer window class name may change in future browser versions. Use this workaround with care.
Please note that neither of these techniques apply if you are automating Internet Explorer. For automation, C++ developers can QueryInterface their browser reference for IWebBrowserApp, whose get_HWND() property is valid whenever Microsoft Internet Explorer is instantiated as a running executable. No such workaround exists for Visual Basic.
STATUSThis behavior is by design. Additional query words:
Keywords : kbIE400 kbIE401 kbWebBrowser kbIE401sp2 kbGrpInet kbIE500 |
Last Reviewed: December 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |