IDropTarget::Drop  2GBT07N

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 IDataObjectZHWNNR 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 DROPEFFECTVK63LO.

 

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 DoDragDrop3YY1_Q5 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 IDataObjectZHWNNR, 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::DragLeave3MK4_FV 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 DoDragDrop3YY1_Q5, so the source application can clean up after the drag-and-drop operation is complete:

    Remove any source feedback that is being displayed.

    Make any necessary changes to the data, such as removing the data if the operation was a move.

 

See Also

DoDragDrop, IDropSource, IDropTarget, RegisterDragDrop, RevokeDragDrop