To reduce flickering, I create parent windows using the WS_CLIPCHILDREN flag, and call InvalidateRect during the WM_SIZE event. This approach has worked well in Windows XP. However, I recently started programming in Windows 7, and now I'm having trouble rendering when resizing windows. When the window is resized, its contents are not updated until I do something that forces me to redraw, for example, minimize and restore the window.
I tried to execute an InvalidateRect with an UpdateWindow call, but with no effect.
Does anyone know how to do this correctly?
Update
I found a workaround: a call InvalidateRect(childHWND, NULL, FALSE)
on all child windows followed by InvalidateRect(parentHWND, NULL, TRUE)the parent window fixed the rendering problem without introducing noticeable flicker.
Other suggestions are still welcome!
Update 2
I tried RedrawWindow(hwnd, 0, 0, RDW_INVALIDATE | RDW_ALLCHILDREN), but this led to some rendering problems (left pixels).
Update 3
RedrawWindow works, followed by InvalidateRect(hwnd, NULL, TRUE). Thanks @interjay!
source
share