Jump to content

DrgQueryTrueTypeLen

From EDM2

This function obtains the length of the string that represents the true type of a dragged object.

Syntax

DrgQueryTrueTypeLen(pditem)

Parameters

pditem (PDRAGITEM) - input
Pointer to the DRAGITEM structure whose type length is to be obtained.

Returns

ulLength (ULONG) - returns
String length of the first element of the character string associated with hstrType.
0 - Error occurred.
Other - The length of the first element of the character string associated with hstrType, excluding the null-terminating byte.

Remarks

This function can be used to determine the buffer size to allocate for the string representing the true type of a dragged object. The true type of an object is the first type in the type string referenced by hstrType in the DRAGITEM structure. This function can be called before calling the DrgQueryTrueType function. If the input string handle is NULLHANDLE or not valid, a length of 0 is returned.

Errors

Possible returns from WinGetLastError:

PMERR_INVALID_PARAMETERS (0x1208)
An application parameter value is invalid for its converted PM type. For example: a 4-byte value outside the range -32 768 to +32 767 cannot be converted to a SHORT, and a negative number cannot be converted to a ULONG or USHORT.

Example Code

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);

Related Functions