Share via


BeginPaint

This function prepares the specified window for painting and fills a PAINTSTRUCT structure with information about the painting.

HDC BeginPaint( 
HWND hwnd, 
LPPAINTSTRUCT lpPaint
);

Parameters

  • hwnd
    Handle to the window to be repainted.
  • lpPaint
    Long pointer to the PAINTSTRUCT structure that will receive painting information.

Return Values

The handle to a display device context for the specified window indicates success. NULL indicates that no display device context is available.

To get extended error information, call GetLastError.

Remarks

The BeginPaint function automatically sets the clipping region of the device context to exclude any area outside the update region. The update region is set by the InvalidateRect function and by the system after sizing, moving, creating, scrolling, or any other operation that affects the client area. If the update region is marked for erasing, BeginPaint sends a WM_ERASEBKGND message to the window.

An application should not call BeginPaint except in response to a WM_PAINT message. Each call to BeginPaint must have a corresponding call to the EndPaint function.

If the caret is in the area to be painted, BeginPaint automatically hides the caret to prevent it from being erased.

If the windows class has a background brush, BeginPaint uses that brush to erase the background of the update region before returning.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winuser.h   Coredll.lib, Winmgr.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

EndPaint, GetLastError, InvalidateRect, ValidateRect, WM_ERASEBKGND, WM_PAINT, PAINTSTRUCT

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.