Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function retrieves the coordinates of the smallest rectangle that completely encloses the update region of the specified window in client coordinates.

If there is no update region, GetUpdateRectretrieves an empty rectangle; it sets all coordinates to zero.

Syntax

BOOL GetUpdateRect( 
  HWND 
hWnd, 
  LPRECT 
lpRect, 
  BOOL 
bErase
); 

Parameters

hWnd

Handle to the window with an update region that is to be retrieved.

lpRect

Long pointer to the RECTstructure that receives the coordinates of the enclosing rectangle.

An application can set this parameter to NULL to determine whether an update region exists for the window.

If this parameter is NULL, GetUpdateRectreturns nonzero if an update region exists, and zero if one does not.

This provides a simple and efficient means of determining whether a WM_PAINTmessage resulted from an invalid area.

bErase

Boolean that specifies whether the background in the update region is to be erased.

If this parameter is TRUE and the update region is not empty, GetUpdateRectsends a WM_ERASEBKGND message to the specified window to erase the background.

Return Value

Nonzero indicates that the update region is not empty.

Zero indicates that there is no update region.

To get extended error information, call GetLastError.

Remarks

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

BeginPaintautomatically validates the update region, so any call to GetUpdateRectmade immediately after the call to BeginPaintretrieves an empty update region.

Requirements

Header winuser.h
Library coredll.lib, Winmgr.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also