IDropTarget::Drop method (oleidl.h)

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

Syntax

HRESULT Drop(
  [in]      IDataObject *pDataObj,
  [in]      DWORD       grfKeyState,
  [in]      POINTL      pt,
  [in, out] DWORD       *pdwEffect
);

Parameters

[in] pDataObj

A pointer to the IDataObject interface on the data object being transferred in the drag-and-drop operation.

[in] grfKeyState

The current state of the keyboard modifier keys on the keyboard. Possible 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.

[in] pt

A POINTL structure containing the current cursor coordinates in screen coordinates.

[in, out] pdwEffect

On input, pointer to the value of the pdwEffect parameter of the DoDragDrop function. On return, must contain one of the DROPEFFECT flags, which indicates what the result of the drop operation would be.

Return value

This method returns S_OK on success. Other possible values include the following.

Return code Description
E_UNEXPECTED
An unexpected error has occurred.
E_INVALIDARG
The pdwEffect parameter is not valid.
E_OUTOFMEMORY
There is insufficient memory available for this operation.

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 Drop, you must incorporate the data object into the target. Use the formats available in IDataObject, available through pDataObj, 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:

  • 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 being displayed.
  • Make any necessary changes to the data, such as removing the data if the operation was a move.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header oleidl.h

See also

DoDragDrop

IDropSource

IDropSourceNotify

IDropTarget

RegisterDragDrop

RevokeDragDrop