Jump to content

DrgAllocDraginfo: Difference between revisions

From EDM2
No edit summary
Line 1: Line 1:
This function allocates a DRAGINFO structure.
This function allocates a [[DRAGINFO]] structure.


==Syntax==
==Syntax==

Revision as of 03:34, 25 April 2025

This function allocates a DRAGINFO structure.

Syntax

DrgAllocDraginfo(cDitem)

Parameters

cDitem (ULONG) - input
Number of objects being dragged.
This number must be greater than 0.

Returns

Draginfo (PDRAGINFO) - returns
Pointer to the DRAGINFO structure.
NULL - Error occurred.
Other - The DRAGINFO structure.

Errors

Possible returns from WinGetLastError

PMERR_INSUFFICIENT_MEMORY (0x203E)
The operation terminated through insufficient memory.
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.

Remarks

This function must be called before the DrgDrag function is called.

The caller can define a default operation for the objects represented by the DRAGINFO structure by modifying the usOperation field. If the usOperation field is modified, the new value will be sent to the target as the operation whenever a DO_DEFAULT operation would normally be sent. The caller should not modify any other part of the DRAGINFO structure. The DRAGITEM structures associated with the DRAGINFO structure should only be altered with DrgSetDragitem or by using a pointer obtained with DrgQueryDragitemPtr.

Example Code

This example calls the DrgAllocDraginfo function to create a Drag structure for a single object and uses the new structure to set the DRAGITEM (DrgSetDragitem) structure.

#define INCL_WINSTDDRAG  /* Direct Manipulation (Drag) Functions */
#include <os2.h>

PDRAGINFO  pdinfo;       /* Pointer to DRAGINFO structure        */
HWND       hwnd;         /* Handle of calling (source) window    */
BOOL       flResult;     /* Result indicator                     */
DRAGITEM   ditem;        /* DRAGITEM structure                   */

pdinfo = DrgAllocDraginfo(1); /* Create the DRAGINFO structure   */
                              /* Set the drag item               */
flResult= DrgSetDragitem(pdinfo, &ditem, (ULONG)sizeof(ditem), 0);

Related Functions