Jump to content

DrgVerifyTypeSet

From EDM2

This function returns the intersection of the contents of the string associated with the type-string handle for an object and an application-specified type string.

Syntax

DrgVerifyTypeSet(pDragitem, pType, cbBuflen, pBuffer)

Parameters

pDragitem (PDRAGITEM) - input
Pointer to the DRAGITEM structure whose hstrType is to be verified.
pType (PSZ) - input
String specifying the types to search for. This string is in the format: type[,type...]
cbBuflen (ULONG) - input
Size of the return buffer. The buffer should be at least one byte longer than the length of the string pointed to by pType. Must be > 0.
pBuffer (PSZ) - output
Buffer where the intersection string is returned.

Returns

rc (BOOL) - returns
Match indicator.
TRUE - Successful completion.
FALSE - Error occurred.

Remarks

If at least one of the types specified by pType is present in hstrType in the DRAGITEM structure, TRUE is returned.

Example Code

In this example, the DrgVerifyTypeSet function is used to determine whether DRT_TEXT is among the types associated with the object. If it is, the drop is accepted.

#define INCL_WINSTDDRAG /* Direct Manipulation (Drag) Functions */
#include <OS2.H>
#include <stdio.h>
#include <string.h>

BOOL     flResult;
DRAGITEM pditem;
char     szBuffer[32];

case DM_DRAGOVER:
   flResult = DrgVerifyTypeSet(&pditem,
                               "DRT_TEXT",
                               sizeof(szBuffer),
                               szBuffer);
   flResult = strcmp(szBuffer,"DRT_TEXT");
   /**************************************************************/
   /* See if the object is an OS/2 file as well as being of text */
   /* format. AND result flag with previous result flag to get  */
   /* the "effective" return code.                              */
   /**************************************************************/
   flResult = DrgVerifyRMF(&pditem,"DRM_OS2FILE","DRF_TEXT");
   /**************************************************************/
   /* See if DRT_TEXT is the true type of the object            */
   /**************************************************************/
   flResult = DrgVerifyTrueType(&pditem,"DRF_TEXT");
   if(!flResult)
      /**************************************************************/
      /* Inform the application that you will accept the drop    */
      /**************************************************************/
      return(MRFROM2SHORT(DOR_DROP, DO_COPY));
   break;

Related Functions