This example calls the DrgQueryDragitemPtr function to return a pointer to first DRAGITEM structure in the given DRAGINFO structure, after which it obtains the source window handle.
#define INCL_WINSTDDRAG /* Direct Manipulation (Drag) Functions */ #include <os2.h> PDRAGITEM pDragitem; /* DRAGITEM structure pointer */ DRAGINFO Draginfo; /* DRAGINFO structure from which the */ /* DRAGITEM structure is obtained */ ULONG ulIndex; /* Zero-based index of the DRAGITEM */ /* structure pointer to be returned */ HWND hwndSource; /* Source window handle for the drag */ USHORT usn = 0; /* Return pointer to first DRAGITEM */ pDragitem = DrgQueryDragitemPtr(&Draginfo,usn); hwndSource = pDragitem->hwndItem; /* Obtain source window handle */