This example assumes that WinInvalidateRect has been called on a window owned by this window procedure. The application is sent the WM_PAINT message with the entire window as the update rectangle. The window procedure gets the dimensions of the window and calls WinValidateRect to revalidate the window.
#define INCL_WINWINDOWMGR #include <OS2.H> HWND hwnd; RECTL rcl; . . . CASE WM_PAINT: WinQueryUpdateRect(hwnd, &rcl); WinValidateRect(hwnd,&rcl,FALSE); WinFillRect(hwnd,&rcl,CLR_RED); return 0L;