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.

A WebBrowser control application hangs after changing the screen resolution in Internet Explorer 9


View products that this article applies to.

Symptoms

Consider the following scenario. You have a Microsoft .NET web application that uses a WebBrowser control, and in it you try to execute code similar to the following:

MyWebBrowser.Visible = false;
MyWebBrowser.Navigate("about:blank");
MyWebBrowser.Document.Write(String.Empty);

If you use Windows Internet Explorer 9 to browse to the web application page that hosts the control, and then you change the screen resolution (for example launching a full screen application such as a game), the web page hosting the control will become unresponsive.


↑ Back to the top


Cause

This problem occurs because MSHTML.dll keeps sending WM_APP + 2 messages to the application.


↑ Back to the top


Workaround


To workaround this issue, modify the WebBrowser control code so it looks similar to the following:

MyWebBrowser.Visible = false;
MyWebBrowser.Navigate("about:blank");
MyWebBrowser.Document.Write("<HTML><BODY></BODY></HTML>");



↑ Back to the top


Keywords: kb

↑ Back to the top

Article Info
Article ID : 2721787
Revision : 1
Created on : 1/7/2017
Published on : 6/29/2012
Exists online : False
Views : 283