This example sets the icon image that is displayed during a direct manipulation operation.
#define INCL_GPIBITMAPS /* GPI Bit Map Functions */
#define INCL_WINSTDDRAG /* Direct Manipulation (Drag) Functions */
#include <os2.h>
#define ID_BITMAP 257 /* .rc file: "bitmap 257 drgimage.bmp" */
HPS hps; /* Presentation space handle */
BOOL flResult;
HAB hab;
PDRAGINFO pdinfo;
DRAGIMAGE dimg;
HBITMAP hbm; /* Bit-map handle */
HWND hwnd;
/*****************************************************************/
/* Load a bit map for use as a drag image */
/*****************************************************************/
case WM_CREATE:
hps = WinGetPS(hwnd);
hbm = GpiLoadBitmap(hps,0L,ID_BITMAP,20L,20L);
WinReleasePS(hps);
break;
case DM_DRAGOVER:
/*****************************************************************/
/* Initialize the DRAGIMAGE structure */
/*****************************************************************/
dimg.cb = sizeof(DRAGIMAGE); /* Size control block */
dimg.cptl = 0;
dimg.hImage = hbm; /* Image handle passed to */
/* DrgDrag */
dimg.sizlStretch.cx = 20L; /* Size to stretch ico or */
dimg.sizlStretch.cy = 20L; /* bmp to */
dimg.fl = DRG_BITMAP |
DRG_STRETCH; /* Stretch to size specified */
dimg.cxOffset = 0; /* Offset of the origin of */
dimg.cyOffset = 0; /* the image from the pointer*/
/* hotspot */
/*****************************************************************/
/* Set the drag image */
/*****************************************************************/
flResult= DrgSetDragImage(pdinfo,&dimg,(ULONG)sizeof(dimg), NULL);