This example creates a colored pointer from a bit map during the creation of the window (WM_CREATE). The pointer bit map (id IDP_BITMAPPTR in the EXE) and color bit map (id IDP_BITMAPCLR in the EXE file) are loaded via GpiLoadBitmap.
#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 hbmPointer; /* bit-map handle (AND/XOR) */ HBITMAP hbmColor; /* bit-map handle (color) */ POINTERINFO pptriPointerInfo; /* pointer info structure */ case WM_CREATE: hps = WinBeginPaint(hwnd, NULLHANDLE, NULL); /* load pointer bit map */ hbmPointer = GpiLoadBitmap(hps, NULLHANDLE, IDP_BITMAPPTR, 64L, 128L); /* load color bit map */ hbmColor = GpiLoadBitmap(hps, NULLHANDLE, IDP_BITMAPCLR, 64L, 64L); WinEndPaint(hps); /* initialize POINTERINFO structure */ pptriPointerInfo.fPointer = TRUE; /* creating pointer */ pptriPointerInfo.xHotspot = 0; /* x coordinate of hotspot */ pptriPointerInfo.yHotspot = 0; /* y coordinate of hotspot */ pptriPointerInfo.hbmPointer = hbmPointer; pptriPointerInfo.hbmColor = hbmColor; hptr = WinCreatePointerIndirect(HWND_DESKTOP, &pptriPointerInfo);