Flickering ATL

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.
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:

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;
}

Leave a comment