Help and Support

FIX: CHtmlView Does Not Repaint Correctly in an AppWizard-Generated MDI Application

Article ID:220021
Last Review:February 23, 2007
Revision:4.1
This article was previously published under Q220021
On This Page

SYMPTOMS

In an AppWizard-generated MDI application with more than two view windows overlapping each other, if the user clicks in the client area of the MDI frame window other than the view, such that the view loses the focus, and then clicks back in the client area of the view, the CHtmlView does not repaint correctly. However, if the user clicks the nonclient area of the view, the CHtmlView repaints correctly.

Back to the top

CAUSE

The WS_CLIPCHILDREN style is not set for CHtmlView, and therefore, on activating the view by clicking the view area, CHtmlView does not send a message to the embedded Web Browser control to repaint itself.

Back to the top

RESOLUTION

To work around this problem, in PreCreateWindow of CHtmlView, add the WS_CLIPCHILDREN style. Following is a code example:
BOOL CSampleView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
	cs.style |= WS_CLIPCHILDREN;

	return CHtmlView::PreCreateWindow(cs);
} 

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.

This problem was corrected in Microsoft Visual C++ .NET.

Back to the top

MORE INFORMATION

Steps to Reproduce Behavior

1. Create an MDI application using the AppWizard.
2.In step 6/6 of AppWizard, choose View class as CHtmlView.
3.Build and run it.
4.On the File menu, click New, and launch a new ChildFrame so that you have more than two frames, one overlapping the other.
5.Click in the client area of the MDI frame window other than the CHtmlView, such that the view in consideration loses focus.
6.Try to set focus by clicking in the client area of CHtmlView in consideration.

RESULTS: Notice that the view has not completely repainted. Portions of the view window, overlapped by the other view window, are not painted.

Back to the top

REFERENCES

(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Vidyanand N. Rajpathak, Microsoft Corporation.

Back to the top


APPLIES TO
Microsoft Visual C++ 6.0 Enterprise Edition, when used with:
  Microsoft Windows NT 4.0
  Microsoft Windows 95
  Microsoft Windows 98 Standard Edition
Microsoft Visual C++ 6.0 Professional Edition, when used with:
  Microsoft Windows NT 4.0
  Microsoft Windows 95
  Microsoft Windows 98 Standard Edition
Microsoft Visual C++, 32-bit Learning Edition 6.0, when used with:
  Microsoft Windows NT 4.0
  Microsoft Windows 95
  Microsoft Windows 98 Standard Edition
Microsoft Foundation Class Library 4.2
Microsoft Windows 2000 Professional Edition
Microsoft Windows 2000 Server
Microsoft Windows 2000 Advanced Server

Back to the top

Keywords: 
kbbug kbfix kbnoupdate kbdocview KB220021

Back to the top

Article Translations

 

Related Support Centers

Other Support Options

  • Contact Microsoft
    Phone Numbers, Support Options and Pricing, Online Help, and more.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.