This example processes an application-defined message (IDM_FILL). It calls WinGetPS to get a presentation space to the entire window. It 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:
    hps = WinGetPS(hwnd);       /* get presentation space for   */
                                /* the entire window */

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

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

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


[Back] [Next]