The InvalidateRgn function invalidates the client area within the specified region by adding it to the current update region of a window. The invalidated region, along with all other areas in the update region, is marked for painting when the next WM_PAINT message occurs.
BOOL InvalidateRgn(
HWND hWnd, // handle of window with changed update region
HRGN hRgn, // handle of region to add
BOOL bErase // erase-background flag
);
The return value is always nonzero.
Invalidated areas accumulate in the update region until the next WM_PAINT message is processed or until the region is validated by using the ValidateRect or ValidateRgn function.
The system sends a WM_PAINT message to a window whenever its update region is not empty and there are no other messages in the application queue for that window.
The specified region must have been created by using one of the region functions.
If the bErase parameter is TRUE for any part of the update region, the background in the entire region is erased, not just in the specified part.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
Painting and Drawing Overview, Painting and Drawing Functions, BeginPaint, InvalidateRect, ValidateRect, ValidateRgn, WM_PAINT