Share via


IDropTarget::Drop

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

This method incorporates the source data into the target window, removes target feedback, and releases the data object.

Syntax

HRESULT Drop(
  IDataObject* pDataObject,
  DWORD grfKeyState,
  POINTL pt,
  DWORD* pdwEffect
);

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 shown in the following table:

    Flag Description

    MK_ALT

    The user pressed the ALT key.

    MK_CONTROL

    The user pressed the CTRL key.

    MK_LBUTTON

    The user pressed the left mouse button.

    MK_MBUTTON

    The user pressed the middle mouse button.

    MK_RBUTTON

    The user pressed the right mouse button.

    MK_SHIFT

    The user pressed the SHIFT key.

  • pt
    [in] POINTL structure containing the current cursor coordinates in screen coordinates.
  • pdwEffect
    [in, out] Pointer to the current effect flag. Valid values are from the enumeration DROPEFFECT.

Return Value

This method returns S_OK if successful. Otherwise, it returns one of the following values:

  • E_INVALIDARG
  • E_OUTOFMEMORY
  • E_UNEXPECTED

Remarks

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, accessed through pDataObject, along with the current state of the modifier keys to determine how the data is to be incorporated.

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

  • 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, as follows:

  • Removes any source feedback that is being displayed.
  • Makes any necessary changes to the data, such as removing the data if the operation was a move.

Requirements

Header shobjidl.h, shobjidl.idl
Library Developer Implemented
Windows Embedded CE Windows CE .NET 4.2 and later

See Also

Reference

IDropTarget
IDropTarget::DragLeave

Other Resources

IDataObject