Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.


Windows Mobile 6.5
A version of this page is also available for

This function validates the client area within a rectangle by removing the rectangle from the update region of the specified window.

BOOL ValidateRect( 
  HWND hWnd, 
  const RECT* lpRect


Handle to the window whose update region is to be modified.

If this parameter is NULL, the system invalidates and redraws all windows and sends the WM_ERASEBKGND message to the window procedure before the function returns.


Long pointer to a RECT structure that contains the client coordinates of the rectangle to be removed from the update region.

If this parameter is NULL, the entire client area is removed.

Nonzero indicates success.

Zero indicates failure.

To get extended error information, call GetLastError.

Passing in a NULL value for the hWnd parameter is not supported.

The BeginPaint function validates the entire client area.

The ValidateRect function should not be called if a portion of the update region must be validated before the next WM_PAINT message is generated.

The system continues to generate WM_PAINT messages until the current update region is validated.

Librarycoredll.lib, Winmgr.lib
Windows Embedded CEWindows CE 1.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

© 2015 Microsoft