Microsoft KB Archive/183210

= An ATL control may flicker when it is being resized in Visual C++ =

Article ID: 183210

Article Last Modified on 6/3/2005

-

APPLIES TO

 Microsoft ActiveX Template Library 3.0, when used with:  Microsoft Visual C++ 4.2 Enterprise Edition

 Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Enterprise Edition

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

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

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

 Microsoft Visual C++ 6.0 Standard Edition</li></ul>

 Microsoft Windows XP Home Edition</li></ul>

 Microsoft Windows XP Professional</li></ul>

 Microsoft Visual C++ .NET 2002 Standard Edition</li></ul>

 Microsoft Visual C++ .NET 2003 Standard Edition</li></ul> </li> Microsoft ActiveX Template Library 2.0, when used with:  <li>Microsoft Visual C++ 4.2 Enterprise Edition</li></ul>

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

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

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

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

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

<ul> <li>Microsoft Visual C++ 6.0 Standard Edition</li></ul>

<ul> <li>Microsoft Windows XP Home Edition</li></ul>

<ul> <li>Microsoft Windows XP Professional</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2002 Standard Edition</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2003 Standard Edition</li></ul> </li> <li>Microsoft ActiveX Template Library 2.1, when used with: <ul> <li>Microsoft Visual C++ 4.2 Enterprise Edition</li></ul>

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

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

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

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

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

<ul> <li>Microsoft Visual C++ 6.0 Standard Edition</li></ul>

<ul> <li>Microsoft Windows XP Home Edition</li></ul>

<ul> <li>Microsoft Windows XP Professional</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2002 Standard Edition</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2003 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q183210

<div class="symptoms_section">

SYMPTOMS
An ATL control might flicker while it is being resized. For example, if you have a ListView control inside an ATL control and you allow it to be resized at run time, a significant amount of flickering occurs.

<div class="cause_section">

CAUSE
ATL controls are created by default with the CS_HREDRAW and CS_VREDRAW class styles. These styles cause the entire window to be redrawn when the window is resized.

<div class="resolution_section">

RESOLUTION
Remove the CS_HREDRAW and CS_VREDRAW styles from the window by overriding the GetWndClassInfo function. Add the following function to your CComControl-derived class:

Sample Code
static CWndClassInfo& GetWndClassInfo {  static CWndClassInfo wc = {{ sizeof(WNDCLASSEX), 0, StartWindowProc, 0, 0, 0, 0, 0, (HBRUSH)(COLOR_WINDOW+1), 0, "MyControlClass", 0 }, NULL, NULL, IDC_ARROW, TRUE, 0, _T("")}; return wc; }

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

MORE INFORMATION
GetWndClassInfo is called by the CWindowImpl<>::Create method during window creation and uses the WNDCLASS structure initialized by GetWndClassInfo.

Additional query words: WM_PAINT OnPaint OnDraw WM_SIZE OnSize SetObjectRects Invalidate InvalidateRect FireViewChange kbATL200 kbATL210 kbATL300 kbctrl

Keywords: kbtshoot kbctrlcreate kbgdi kbprb KB183210

-

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

© Microsoft Corporation. All rights reserved.