This example shows how to obtain the length of the true type string with the DrgQueryTrueTypeLen function.
#define INCL_WINSTDDRAG /* Direct Manipulation (Drag) Functions */
#define INCL_DOSMEMMGR /* Memory Management Functions for */
/* DosAllocMem */
#include <OS2.H>
PSZ pszBuffer; /* Buffer in which the DRAGITEM */
/* structure is stored */
BOOL fSuccess; /* Return value */
DRAGITEM Dragitem; /* DRAGITEM structure whose true type */
/* length is to be obtained */
ULONG rc; /* Return code */
ULONG ulLength; /* String length of dragged object */
ulLength = DrgQueryTrueTypeLen(&Dragitem) + 1;
rc = DosAllocMem((PVOID *) pszBuffer, ulLength, fPERM);
fSuccess = DrgQueryTrueType(&Dragitem, ulLength, pszBuffer);