I have a Win32 GUI program with a tab control, each tab has a list control. When the window is resized, massive flickering occurs. I have tried the following things:
- Processing WM_ERASEBKGND in the main wndproc and returning TRUE. There is no effect.
- Filtering all WM_ERASEBKGND messages in the event loop. There is no effect.
- Setting the WM_CLIPCHILDREN style in the main window. Now, when the window changes, the list control is simply deleted on a white background and not redrawn.
- Using DefWindowPos instead of MoveWindow. There is no effect.
- Passing FALSE for bRepaint in MoveWindow. Same effect as setting WS_CLIPCHILDREN (see above).
Here's the RegisterClassEx code:
memset(&wcex, 0, sizeof(WNDCLASSEX));
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = 0;
wcex.lpfnWndProc = PhMainWndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = PhInstanceHandle;
wcex.hIcon = LoadIcon(PhInstanceHandle, MAKEINTRESOURCE(IDI_PROCESSHACKER));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.lpszMenuName = MAKEINTRESOURCE(IDR_MAINWND);
wcex.lpszClassName = PhWindowClassName;
wcex.hIconSm = (HICON)LoadImage(PhInstanceHandle, MAKEINTRESOURCE(IDI_PROCESSHACKER), IMAGE_ICON, 16, 16, 0);
WM_SIZE handler:
RECT rect;
GetClientRect(PhMainWndHandle, &rect);
MoveWindow(TabControlHandle, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top, TRUE);
TabCtrl_AdjustRect(TabControlHandle, FALSE, &rect);
MoveWindow(ListViewHandle, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top, TRUE);
Styles:
- Main window:
WS_OVERLAPPEDWINDOW - :
WS_CHILD ( WS_VISIBLE) - :
WS_CHILD | WS_BORDER | LVS_REPORT ( WS_VISIBLE)