This example processes an application-defined message (IDM_FILL). It calls WinGetScreenPS to get a presentation space for the entire desktop window, gets the dimensions of the current window, fills the window, and calls WinReleasePS to release the presentation space.

#define INCL_WINWINDOWMGR       /* Window Manager Functions     */
#include <os2.h>

HWND    hwnd;           /* parent window                        */
RECTL  rcl;             /* update region                        */
HPS    hps;             /* presentation-space handle            */

case IDM_FILL:
    /* get presentation space for the entire desktop */
    hps = WinGetScreenPS(HWND_DESKTOP);

    WinQueryWindowRect(hwnd, &rcl);    /* get window dimensions */

    WinFillRect(hps, &rcl, CLR_WHITE); /* clear entire window   */

    WinReleasePS(hps);             /* release the presentation space   *
    return 0L;


[Back] [Next]