This example uses WinIsWindowShowing to check if any part of the window is physically visible before causing a redraw of the window via WinInvalidateRect.
#define INCL_WINWINDOWMGR /* Window Manager Functions */ #define INCL_WINFRAMEMGR /* Window Frame Functions */ #include <os2.h> HWND hwnd; /* Window handle */ RECTL rcl; /* Update region */ /* If any part of the window is visible, cause a redraw */ if (WinIsWindowShowing(hwnd)) { WinQueryUpdateRect(hwnd, &rcl); WinInvalidateRect(hwnd, /* Window to invalidate */ &rcl, /* Invalid rectangle */ FALSE); /* Do not include children */ }