IDropTarget::Drop

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

HRESULT Drop(

IDataObject * pDataObject,

//Pointer to the interface for the source data

DWORD grfKeyState,

//Current state of keyboard modifier keys

POINTL pt,

//Pointer to the current cursor coordinates

DWORD * pdwEffect

//Pointer to the effect of the drag-and-drop operation

);

Parameters

pDataObject
[in] Pointer to the IDataObject interface on the data object being transferred in the drag-and-drop operation.
grfKeyState
[in] 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] Pointer to the current cursor coordinates in the coordinate space of the drop target window.
pdwEffect
[in, out] Pointer to the current effect flag. Valid values are from the enumeration DROPEFFECT.

Return Values

This method supports the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following:

S_OK
The method completed its tasks successfully.

Remarks

You do not call this method directly. The DoDragDrop function calls this method when the user completes the drag-and-drop operation.

In implementing IDropTarget::Drop, you must incorporate the data object into the target. Use the formats available in IDataObject, available through pDataObject, along with the current state of the modifier keys to determine how the data is to be incorporated, such as linking or embedding.

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

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:

See Also

DoDragDrop, IDropSource, IDropTarget, RegisterDragDrop, RevokeDragDrop