This example draws a bit map pointer, created by either WinCreatePointer or WinCreatePointerIndirect, in response to a paint message (WM_PAINT).

#define INCL_WINPOINTERS        /* Window Pointer Functions     */
#define INCL_GPIBITMAPS         /* Graphics bit-map functions    */
#include <os2.h>

HPS   hps;              /* presentation-space handle            */
HWND  hwnd;             /* window handle                        */
HPOINTER  hptr;         /* bit-map pointer handle               */
HBITMAP  hbm;           /* bit-map handle                       */
BOOL  fSuccess;         /* success indicator                    */
ULONG   ulHalftone=DP_NORMAL; /* draw with normal shading       */

case WM_CREATE:
     hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
     hbm = GpiLoadBitmap(hps, 0L, IDP_BITMAP, 64L, 64L);
     WinEndPaint(hps);

     hptr = WinCreatePointer(HWND_DESKTOP, hbm,
                             TRUE, /* use true (system) pointer */
                             0, 0); /* hot spot offset (0,0)    */

case WM_PAINT:
     hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
     fSuccess = WinDrawPointer(hps, 50, 50, hptr, ulHalftone);
     WinEndPaint(hps);


[Back] [Next]