The DRAGINFO Structure

The DRAGINFO structure contains information about the overall drag operation, which may consist of one or more dragitems. Information in the DRAGINFO structure determines the source and type of the drag operation, and provides pointers to one or more DRAGITEM structures which identify individual dragitems.

The handle of the source window for the drag operation is contained in the DRAGINFO structure. This handle enables a target window which receives the structure to initiate a conversation with the source window if necessary, in order to exchange information.

The other item of note in the DRAGINFO structure is a field which identifies the type of drag operation that the user has selected. For example, a value of DO_COPY means that the user is holding the Ctrl key down, which by convention means that a copy operation is required. The DO_DEFAULT value means that a default drag operation is to be used because the user is not holding down any modifier key.

The DRAGINFO structure contains a counter that specifies how many dragitems are involved in the current operation. This counter is then used to access an array of pointers, also contained within the DRAGINFO structure, which reference individual DRAGITEM structures for each dragitem.

Note that the DRAGINFO structure must be accessible not only to the source window that sets it up in the first place, but also to any potential target windows. Since these windows may not be owned by the same process, the DRAGINFO structure must be allocated in shared memory. In order that the structure be correctly allocated and easily accessible by the system in order to provide it to potential target windows, OS/2 allocates the DRAGINFO structure on the application's behalf, using the DrgAllocDraginfo() function. This function is called by the source window when it is notified of a drag operation by receiving a WM_BEGINDRAG message.

For Workplace Shell objects, the Workplace Shell handles the allocation and initialization of the DRAGINFO structure. The object itself is not required to take any action with respect to this structure.


[Back: Data Structures Used in Drag/Drop]
[Next: The DRAGITEM Structure]