HDC BeginPaint(hWnd,lpPaint)
This function prepares the given window for painting and fills the paint structure pointed to by the lpPaint parameter with information about the painting.
The paint structure contains a handle to the device context for the window, a RECT data structure that contains the smallest rectangle that completely encloses the update region, and a flag that specifies whether or not the background has been erased.
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 or InvalidateRgn functions 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 the BeginPaint function except in response to a WM_PAINT message. Each BeginPaint call must have a matching call to the EndPaint function.
Parameter | Type/Description |
hWnd | HWND Identifies the window to be repainted. | |
lpPaint | LPPAINTSTRUCT Points to the PAINTSTRUCT data structure that is to receive painting information, such as the device context for the window and the update rectangle. |
The return value identifies the device context for the specified window.
If the caret is in the area to be painted, the BeginPaint function automatically hides the caret to prevent it from being erased.