This example shows how an application gets a presentation space for drawing by calling the WinBeginPaint function. When drawing is complete, the WinEndPaint function is called to release the presentation space.
case WM_PAINT:
hps = WinBeginPaint(hwnd, NULL, &rcl);
.
. /* drawing routines would go here */
.
WinEndPaint(hps);
return (0L);