Jump to content

DrgFreeDraginfo: Difference between revisions

From EDM2
 
Line 5: Line 5:


==Parameters==
==Parameters==
;pdinfo (PDRAGINFO) - input: Pointer to the DRAGINFO structure.
;pdinfo (PDRAGINFO) - input: Pointer to the [[DRAGINFO]] structure.


==Returns==
==Returns==

Latest revision as of 03:39, 25 April 2025

This function frees a DRAGINFO structure allocated by DrgAllocDraginfo.

Syntax

DrgFreeDraginfo(pdinfo)

Parameters

pdinfo (PDRAGINFO) - input
Pointer to the DRAGINFO structure.

Returns

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

Remarks

DrgFreeDraginfo fails with an error of PMERR_SOURCE_SAME_AS_TARGET if it is called by the process that called DrgDrag before DrgDrag returns. When a process is performing a drag operation between two of its own windows, this prevents the source window from freeing the DRAGINFO structure before the target window finishes processing.

Errors

Possible returns from WinGetLastError:

PMERR_MEMORY_DEALLOCATION_ERR (0x1113)
An error occurred during memory management.
PMERR_SOURCE_SAME_AS_TARGET (0x1502)
The direct manipulation source and target process are the same.

Example Code

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

BOOL      fSuccess; /* Indicate success or failure         */
PDRAGINFO pdinfo;   /* Pointer to DRAGINFO structure       */
HWND      hwnd;     /* Handle of calling (source) window   */
DRAGIMAGE dimg;     /* DRAGIMAGE structure                 */
HWND      hwndDrop; /* Handle of drop (target) window     */

/****************************************************************/
/* Perform the drag operation:                                  */
/* - Give the user a visual cue by changing the pointer to a    */
/* bit map                                                    */
/* - Send DM_DRAGOVER messages to the target window (in this    */
/* case it is also the source)                                */
/****************************************************************/
hwndDrop = DrgDrag(hwnd,            /* Source of the drag            */
                  pdinfo,          /* Pointer to DRAGINFO structure */
                  (PDRAGIMAGE)&dimg, /* Drag image                    */
                  1,               /* Size of the pdimg array       */
                  VK_ENDDRAG,      /* Release of drag button        */
                                   /* Terminates the drag           */
                  NULL);          /* Reserved                      */

fSuccess = DrgFreeDraginfo(&pdinfo);

Related Functions