Microsoft KB Archive/179421

= FIX: WebBrowser Control in CFormView Does Not Repaint Properly =

Article ID: 179421

Article Last Modified on 8/18/2005

-

APPLIES TO

 Microsoft Internet Explorer 3.0 Microsoft Internet Explorer 3.01 Microsoft Internet Explorer 3.02 Microsoft ActiveX SDK Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 4.2 Enterprise Edition

 Microsoft Visual C++ 4.2 Professional Edition</li></ul>

 Microsoft Visual C++ 4.2 Enterprise Edition</li></ul>

 Microsoft Visual C++ 4.2 Professional Edition</li></ul>

 Microsoft Visual C++ 5.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 5.0 Professional Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q179421

<div class="symptoms_section">

SYMPTOMS
When you resize the WebBrowser control inside a CFormView, it may not repaint correctly.

You may experience the scroll bars not being redrawn.

<div class="cause_section">

CAUSE
The WebBrowser control does not handle WM_PAINT messages correctly when it is being resized.

<div class="resolution_section">

RESOLUTION
When the WebBrowser control is resized, update the client area of the WebBrowser control by calling UpdateWindow.

<div class="status_section">

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in Microsoft Internet Explorer 4.0.

<div class="moreinformation_section">

MORE INFORMATION
The following code shows how the WebBrowser control would normally be resized when the client window is resized. The call to UpdateWindow causes a WM_PAINT message to be sent directly to the window of the control. // CMyFormView is derived from CFormView. // m_browser is a CWnd-derived class that wraps the webbrowser control. void CMyFormView::OnSize(UINT nType, int cx, int cy) {     CFormView::OnSize(nType, cx, cy); // Ensure m_browser has valid HWND before doing anything if ( m_browser.GetSafeHwnd ) {        // Resize WebBrowser control to fill the client area m_browser.MoveWindow(0, 0, cx, cy); // Force processing of WM_PAINT m_browser.UpdateWindow; }  }

Additional query words: web browser shdocvw.dll

Keywords: kbbug kbfix KB179421

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.