InvalidateRect

2.x

  void InvalidateRect(hwnd, lprc, fErase)    
  HWND hwnd; /* handle of window with changed update region */
  const RECT FAR* 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.

Parameters

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 */
   int left;
   int top;
   int right;
   int bottom;
} RECT;

For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.

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.

Return Value

This function does not return a value.

Comments

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.

See Also

BeginPaint, InvalidateRgn, ValidateRect, ValidateRgn