This function invalidates the client area within the specified region by adding the area to the current update region of a window.
InvalidateRgn also marks the invalidated region, along with all other areas in the update region, for painting when the next WM_PAINT message occurs.
BOOL WINAPI InvalidateRgn( HWND hWnd, HRGN hRgn, BOOL fErase );
[in] Handle to the window that contains an update region that you want to modify.
[in] Handle to the region that you want to add to the update region.
InvalidateRgn assumes that the region has client coordinates.
Set this parameter to NULL to add the entire client area to the update region.
[in] Boolean that specifies whether you want the background within the update region to be erased when the update region is processed.
TRUE indicates that the background is erased when the BeginPaint function is called.
FALSE indicates that the background remains unchanged.
Invalidated areas accumulate in the update region until the application processes the next WM_PAINT message or until the application validates the region by calling the ValidateRect or ValidateRgn function.
The system sends a WM_PAINT message to a window whenever the update region for the application is not empty and the application queue for that window contains no messages.
You must create the specified region by using one of the region functions, such as ExtCreateRegion.
If the fErase parameter is TRUE for any part of the update region, the background in the entire region is erased, not just the background in the specified part.