Share via


RedrawWindow

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function updates the specified rectangle or region in the client area of a window.

Syntax

BOOL WINAPI RedrawWindow(
  HWND hwnd,
  CONST RECT* lprcUpdate,
  HRGN hrgnUpdate,
  UINT flags
);

Parameters

  • hwnd
    [in] Handle to the window that you want to redraw.

    If this parameter is NULL, RedrawWindow updates the desktop window.

  • lprcUpdate
    [in] Pointer to a RECT structure that contains the coordinates, in device units, of the update rectangle.

    RedrawWindow ignores this parameter if the hrgnUpdate parameter identifies a region.

  • hrgnUpdate
    [in] Handle to the update region.

    If both the hrgnUpdate and lprcUpdate parameters are NULL, RedrawWindow adds the entire client area to the update region.

  • flags
    [in] DWORD that specifies one or more redraw options.

    You can use this parameter to invalidate or validate a window, control when repainting occurs, and control the windows that RedrawWindow affects.

    The following table shows the values that invalidate the window.

    Value Description

    RDW_ERASE

    Causes the window to receive a WM_ERASEBKGND message when the window is repainted.

    Specify this value in combination with the RDW_INVALIDATE value; otherwise, RDW_ERASE has no effect.

    RDW_INTERNALPAINT

    Causes the OS to post a WM_PAINT message to the window regardless of whether a portion of the window is invalid.

    RDW_INVALIDATE

    Invalidates the rectangle or region that you specify in lprcUpdate or hrgnUpdate.

    You can set only one of these parameters to a non-NULL value.

    If both are NULL, RDW_INVALIDATE invalidates the entire window.

    The following table shows the values that validate the window.

    Value Description

    RDW_NOERASE

    Suppresses any pending WM_ERASEBKGND messages.

    RDW_VALIDATE

    Validates the rectangle or region that you specify in lprcUpdate or hrgnUpdate.

    You can set only one of these parameters to a non-NULL value.

    If both are NULL, RDW_VALIDATE validates the entire window.

    This value does not affect internal WM_PAINT messages.

    The following table shows the values that control when repainting occurs. RedrawWindow does not repaint unless you specify one of these values.

    Value Description

    RDW_ERASENOW

    Causes the affected windows, which you specify by setting the RDW_ALLCHILDREN and RDW_NOCHILDREN values, to receive WM_ERASEBKGND messages before RedrawWindow returns, if necessary.

    The affected windows receive WM_PAINT messages at the ordinary time.

    RDW_UPDATENOW

    Causes the affected windows, which you specify by setting the RDW_ALLCHILDREN and RDW_NOCHILDREN values, to receive WM_ERASEBKGND and WM_PAINT messages before the RedrawWindow returns, if necessary.

    By default, the set of windows that RedrawWindow affects depends on whether the windows have the WS_CLIPCHILDREN style.

    RedrawWindow does not affect child windows that do not have the WS_CLIPCHILDREN style.

    RedrawWindow recursively validates or invalidates non-WS_CLIPCHILDREN windows until RedrawWindow encounters a WS_CLIPCHILDREN window.

    The following table shows the values that control the windows that RedrawWindow affects.

    Value Description

    RDW_ALLCHILDREN

    Includes child windows, if any, in the repainting operation.

    RDW_NOCHILDREN

    Excludes child windows, if any, from the repainting operation.

Return Value

A nonzero value indicates success. Zero indicates failure. To get extended error information, call GetLastError.

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

WM_ERASEBKGND
WM_PAINT
RECT