This example uses DrgReallocDragInfo to reallocate the DRAGINFO structure when an object is picked up or added to the lazy drag set. It checks whether a lazy drag operation is already in progress, and if so, adds one to the number of objects currently being dragged and calls DrgReallocDragInfo to obtain a new DRAGINFO structure with the required number of DRAGITEM structures.
#define INCL_WINSTDDRAG #include <os2.h> PDRAGINFO pdinfoCurrent; /* Pointer to the current DRAGINFO */ PDRAGINFO pdinfoOld; /* Pointer to the DRAGINFO to be freed */ ULONG cditem; /* Number of DRAGITEMS */ . . . case WM_PICKUP: if (DrgQueryDragStatus() & DGS_LAZYDRAGINPROGRESS) { /* Get a pinter to the current DRAGINFO structure */ pdinfoOld=DrgQueryDraginfoPtr(NULL); /* Add space for one more DRAGITEM */ cditem=pdinfoOld->cditem+1; /* Reallocate the DRAGINFO */ pdinfoCurrent=DrgReallocDraginfo(pdinfoOld, cditem); if(pdinfoCurrent) { /* Continue the lazy drag operation */ DrgLazyDrag( ... ) } }