This function prepares the specified window for painting and fills a PAINTSTRUCT structure with information about the painting.
At a Glance
Header file: | Winuser.h |
Windows CE versions: | 1.0 and later |
Syntax
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 window’s class has a background brush, BeginPaint uses that brush to erase the background of the update region before returning.
See Also