This example uses WinExcludeUpdateRegion to prevent drawing into the window's known invalid regions (to optimize updates) by excluding the window's update region from the clipping region of the presentation space. The clipping region will need to be reset later by the application, which can accomplished using GpiIntersectClipRectangle with the rectangle comprising the window as input.
#define INCL_WINWINDOWMGR /* Window Manager Functions */ #define INCL_GPIREGIONS /* Region functions */ #include <os2.h> LONG lComplexity; /* clipping complexity/error return */ HWND hwnd; /* parent window */ RECTL rcl; /* update region */ HPS hps; /* presentation-space handle */ case WM_PAINT: lComplexity = WinExcludeUpdateRegion(hps, hwnd); hps = WinBeginPaint(hwnd, /* handle of the window */ NULLHANDLE, /* get a cache presentation space */ &rcl); /* receives update rectangle */ WinFillRect(hps, &rcl, CLR_WHITE); WinEndPaint(hps);