This example fills an update rectangle with a white background in response to the WM_PAINT message, after obtaining a presentation space handle via WinBeginPaint.
#define INCL_WINWINDOWMGR /* Window Manager Functions */ #include <os2.h> BOOL fSuccess; /* success indicator */ HAB hab; /* anchor-block handle */ PRECTL prclRect1 = {0,0,100,100}; /* fill rectangle */ LONG lColor=CLR_WHITE; /* fill color */ HWND hwnd; /* client window handle */ HPS hps; /* presentation-space handle */ case WM_PAINT: hps = WinBeginPaint(hwnd, NULLHANDLE, &prclRect1); fSuccess = WinFillRect(hps, &prclRect1, lColor); WinEndPaint(hps);