This example calls the DrgFreeDraginfo function to free an existing DRAGINFO structure allocated by the DrgAllocDraginfo function after a drag operation has completed.
#define INCL_WINSTDDRAG /* Direct Manipulation (Drag) Functions */
#include <os2.h>
BOOL fSuccess; /* Indicate success or failure */
PDRAGINFO pdinfo; /* Pointer to DRAGINFO structure */
HWND hwnd; /* Handle of calling (source) window */
DRAGIMAGE dimg; /* DRAGIMAGE structure */
HWND hwndDrop; /* Handle of drop (target) window */
/****************************************************************/
/* Perform the drag operation: */
/* - Give the user a visual cue by changing the pointer to a */
/* bit map */
/* - Send DM_DRAGOVER messages to the target window (in this */
/* case it is also the source) */
/****************************************************************/
hwndDrop = DrgDrag(hwnd, /* Source of the drag */
pdinfo, /* Pointer to DRAGINFO structure */
(PDRAGIMAGE)&dimg, /* Drag image */
1, /* Size of the pdimg array */
VK_ENDDRAG, /* Release of drag button */
/* Terminates the drag */
NULL); /* Reserved */
fSuccess = DrgFreeDraginfo(&pdinfo);