BOOL InvalidateRect(hwnd, lprc, fErase) | |||||
HWND hwnd; | /* handle of window with changed update region | */ | |||
CONST RECT *lprc; | /* address of structure with rectangle | */ | |||
BOOL fErase; | /* erase-background flag | */ |
The InvalidateRect function adds a rectangle to a window's update region. The update region represents the client area of the window that must be redrawn.
hwnd
Identifies the window whose update region has changed.
lprc
Points to a RECT structure that contains the client coordinates of the rectangle to be added to the update region. If the lprc parameter is NULL, the entire client area is added to the update region.
The RECT structure has the following form:
typedef struct tagRECT { /* rc */
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;
fErase
Specifies whether the background within the update region is to be erased when the update region is processed. It this parameter is TRUE, the background is erased when the BeginPaint function is called. If this parameter is FALSE, the background remains unchanged.
The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.
The invalidated areas accumulate in the update region until the region is processed when the next WM_PAINT message occurs, or until the region is validated by using the ValidateRect or ValidateRgn function.
Windows 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.
If the fErase parameter is TRUE for any part of the update region, the background is erased in the entire region, not just in the given part.
BeginPaint, InvalidateRgn, ValidateRect, ValidateRgn