Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

BUG: WebBrowser Control Destroyed When Hidden


View products that this article applies to.

This article was previously published under Q182111

↑ Back to the top


Symptoms

The Microsoft WebBrowser control is used in a Microsoft Foundation Class (MFC) application and, following the dynamic creation of the control or call to ShowWindow(SW_HIDE), results in the control's methods not functioning or a debug assertion in Winocc.cpp.

↑ Back to the top


Cause

If the WebBrowser control is created dynamically without specifying the WS_VISIBLE window style, or if the control's ShowWindow(SW_HIDE) method is called, this results in a call to the control's IOleControl::DoVerb() method with the OLEVERB_HIDE verb. This in turn causes the instance of Internet Explorer to be destroyed, preventing further access to the control's methods, or if built with a debug configuration, the application asserts when CWnd methods are called for the control.

↑ Back to the top


Resolution

Specify the WS_VISIBLE window style when dynamically creating a WebBrowser control and do not call the control's ShowWindow(SW_HIDE) method.

↑ Back to the top


Status

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information

If you need to hide the WebBrowser control, call the Windows SDK ShowWindow() API directly.

Use the following code to hide the control:
::ShowWindow( m_Control.GetSafeHwnd(), SW_HIDE );
				
Use the following code to show the control:
::ShowWindow( m_Control.GetSafeHwnd(), SW_SHOW );
				

↑ Back to the top


Keywords: kbbug, kbpending, KB182111

↑ Back to the top

Article Info
Article ID : 182111
Revision : 2
Created on : 5/12/2003
Published on : 5/12/2003
Exists online : False
Views : 420