An ATL control may flicker when it is being resized in Visual C++ (183210)
The information in this article applies to:
- The Microsoft Active Template Library (ATL) 3.0, when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Windows XP Home Edition
- Microsoft Windows XP Professional
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ .NET (2003)
- The Microsoft Active Template Library (ATL) 2.0, when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Windows XP Home Edition
- Microsoft Windows XP Professional
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ .NET (2003)
- The Microsoft Active Template Library (ATL) 2.1, when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Windows XP Home Edition
- Microsoft Windows XP Professional
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ .NET (2003)
This article was previously published under Q183210 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.
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. 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;
}
STATUS This behavior is by design. MORE INFORMATION GetWndClassInfo() is called by the
CWindowImpl<>::Create() method during window creation and uses the
WNDCLASS structure initialized by GetWndClassInfo().
Modification Type: | Major | Last Reviewed: | 6/3/2005 |
---|
Keywords: | kbtshoot kbCtrlCreate kbGDI kbprb KB183210 kbAudDeveloper |
---|
|