Partager via


IDropTarget (Windows Embedded CE 6.0)

1/6/2010

This interface is used to allow drag-and-drop operations in an application. Its methods are used by any application that can be a target for drag-and-drop operations.

When to Implement

Implement this interface if you are developing an application that can act as a target for a drag-and-drop operation. The IDropTarget interface is associated with your application windows and is implemented on your window objects. Call the RegisterDragDrop function to register your window objects as drop targets.

Methods

The following table shows the methods for this interface by functional grouping. Like all COM interfaces, this interface inherits the methods for the IUnknown interface.

Grouping Method

Drag Operations

DragEnter

 

DragOver

 

DragLeave

Drop Operations

Drop

Obtaining a Pointer

Do not call the methods of IDropTarget directly. See Remarks for more information.

Remarks

An application that can be a target for drag-and-drop operations is responsible for the following:

  • Determining the effect of the drop on the target application.
  • Incorporating any valid data when the drop occurs.
  • Communicating target feedback to the source application so it can provide appropriate visual feedback, such as setting the cursor.
  • Implementing drag scrolling.
  • Registering and revoking its application windows as drop targets.

The IDropTarget interface contains methods that handle all these responsibilities except registering and revoking the application window as a drop target. For those tasks, you must call the RegisterDragDrop and the RevokeDragDrop functions.

Do not call the methods of IDropTarget directly. The DoDragDrop function calls the IDropTarget methods during the drag-and-drop operation. For example, DoDragDrop calls IDropTarget::DragEnter when it detects the mouse has moved over a window that is registered as a drag target. Once the mouse has entered a drag-target window, DoDragDrop calls IDropTarget::DragOver as the mouse moves through the window and calls IDropTarget::DragLeave if the mouse leaves the target window or if the user cancels or completes the drag-and-drop operation. DoDragDrop calls IDropTarget::Drop if the drop finally occurs.

Requirements

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

See Also

Reference

Standard Shell Interfaces