IDropTarget::Drop

Incorporates the source data into the target window, removes target feedback, and releases the data object.

HRESULT Drop(

IDataObject * pDataObject,
//IDataObject interface for the source data
DWORD grfKeyState,
//Current state of keyboard modifier keys
POINTL pt,
//Current cursor coordinates
DWORD * pdwEffect
//Effect of the drag-and-drop operation
);

Parameters

pDataObject

[in] Points to the data object being transferred in the drag-and-drop operation. The data is represented in the IDataObject interface.

grfKeyState

[in] Identifies the current state of the keyboard modifier keys on the keyboard. Valid values can be a combination of any of the flags MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.

pt

[in] Points to the current cursor coordinates in the coordinate space of the drop target window.

pdwEffect

[in, out] Specifies the current effect flag. Valid values are from the enumeration DROPEFFECT.

Return Values

S_OK

The function completed its tasks successfully.

E_OUTOFMEMORY

Out of memory.

E_INVALIDARG

One or more arguments are invalid.

E_UNEXPECTED

An unexpected error occurred.

Comments

The DoDragDrop function calls this method when the user completes the drag-and-drop operation.

In IDropTarget::Drop, you must incorporate the data object into the target. You can use the formats available in IDataObject along with the current state of the modifier keys to determine how the data is to be incorporated. This can be, for example, linking the data or embedding it.

In addition to incorporating the data, you must also clean up as you do in the IDropTarget::DragLeave method:

  • Remove any target feedback that is currently displayed.

  • Release any references to the data object.

You also pass the effect of this operation back to the source application through DoDragDrop, so the source application can clean up after the drag-and-drop operation is complete:

  • Remove any source feedback that is currently displaying.

  • Make any necessary changes to the data, for example, removing the data if the operation was a move.

See Also

DoDragDrop, IDropSource, IDropTarget, RegisterDragDrop, RevokeDragDrop

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database