UpdateWindow() vs InvalidateRect()
-
Hi guys, Can anyone explain the differences between the following two calls:
UpdateWindow(hWnd);
and
InvalidateRect(hWnd, NULL, FALSE);
If I replace one with another, the app would be drawn differently. But I couldn't tell why by reading the MSDN docs :( Thanks alot
-
Hi guys, Can anyone explain the differences between the following two calls:
UpdateWindow(hWnd);
and
InvalidateRect(hWnd, NULL, FALSE);
If I replace one with another, the app would be drawn differently. But I couldn't tell why by reading the MSDN docs :( Thanks alot
I think I sort of know now -
UpdateWindow(hWnd)
only places a WM_PAINT message in the message queue, which leads to an execution of the WM_PAINT's message handler finally. If at that time the client area is all validated already, the window will not be re-painted. On the other hand,InvalidateRect(hWnd, NULL, FALSE)
explicitly invalidates the client area and then sends a WM_PAINT message. This makes sure the window will always be re-painted when the WM_PAINT message handler reaches its time. It does two things instead of just one. Please correct me if I am wrong here. Thanks