Share via


InvalidateRgn

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function invalidates the client area within the specified region by adding the area to the current update region of a window.

InvalidateRgn also marks the invalidated region, along with all other areas in the update region, for painting when the next WM_PAINT message occurs.

Syntax

BOOL WINAPI InvalidateRgn(
  HWND hWnd,
  HRGN hRgn,
  BOOL fErase
);

Parameters

  • hWnd
    [in] Handle to the window that contains an update region that you want to modify.
  • hRgn
    [in] Handle to the region that you want to add to the update region.

    InvalidateRgn assumes that the region has client coordinates.

    Set this parameter to NULL to add the entire client area to the update region.

  • fErase
    [in] Boolean that specifies whether you want the background within the update region to be erased when the update region is processed.

    TRUE indicates that the background is erased when the BeginPaint function is called.

    FALSE indicates that the background remains unchanged.

Return Value

The return value is always nonzero.

Remarks

Invalidated areas accumulate in the update region until the application processes the next WM_PAINT message or until the application validates the region by calling the ValidateRect or ValidateRgn function.

The system sends a WM_PAINT message to a window whenever the update region for the application is not empty and the application queue for that window contains no messages.

You must create the specified region by using one of the region functions, such as ExtCreateRegion.

If the fErase parameter is TRUE for any part of the update region, the background in the entire region is erased, not just the background in the specified part.

Requirements

Header windows.h
Library coredll.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

BeginPaint
ExtCreateRegion
InvalidateRect
ValidateRect
ValidateRgn
WM_PAINT