GetUpdateRect

  BOOL GetUpdateRect(hwnd, lprc, bErase)    
  HWND hwnd; /* handle of window */
  LPRECT lprc; /* address of structure for update rectangle */
  BOOL bErase; /* erase flag */

This function retrieves the coordinates of the smallest rectangle that completely encloses the update region of the given window. If the window was created with the CS_OWNDC style and the mapping mode is not MM_TEXT, the GetUpdateRect function gives the rectangle in logical coordinates. Otherwise, GetUpdateRect gives the rectangle in client coordinates. If there is no update region, GetUpdateRect makes the rectangle empty (sets all coordinates to zero).

The bErase parameter specifies whether GetUpdateRect should erase the background of the update region. If bErase is TRUE and the update region is not empty, the background is erased. To erase the background, GetUpdateRect sends a WM_ERASEBKGND message to the given window.

Parameters

hwnd

Identifies the window whose update region is to be retrieved.

lprc

Points to the RECT structure that is to receive the client coordinates of the enclosing rectangle.

bErase

Specifies whether the background in the update region is to be erased.

Return Value

The return value specifies the status of the update region of the given window. It is nonzero if the update region is not empty. Otherwise, it is zero.

Comments

The update rectangle retrieved by the BeginPaint function is identical to that retrieved by the GetUpdateRect function.

BeginPaint automatically validates the update region, so any call to GetUpdateRect made immediately after the BeginPaint call retrieves an empty update region.

See Also

BeginPaint, GetUpdateRgn