This example calls the DrgQueryDragitem function to return the entirety of the 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> BOOL fSuccess; /* Indicate success or failure */ DRAGINFO Draginfo; /* DRAGINFO structure from which the */ /* DRAGITEM structure is obtained */ ULONG cbBuffer; /* Maximum number of bytes to copy */ DRAGITEM Dragitem; /* Buffer into which the DRAGITEM */ /* structure is copied */ ULONG iItem; /* Zero-based index of the DRAGITEM */ /* to be returned */ HWND hwndSource; /* Source window handle for the drag */ cbBuffer = sizeof(DRAGITEM); /* Copy entire DRAGITEM structure */ iItem = 0; /* Return first DRAGITEM */ fSuccess = DrgQueryDragitem(&Draginfo,cbBuffer,&Dragitem,iItem); hwndSource = Dragitem.hwndItem; /* Obtain source window handle */