Partager via


IVsObjectList.DoDragDrop Method

Asks the given list item to handle a drag-and-drop operation.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
Function DoDragDrop ( _
    index As UInteger, _
    pDataObject As IDataObject, _
    grfKeyState As UInteger, _
    <OutAttribute> ByRef pdwEffect As UInteger _
) As Integer
int DoDragDrop(
    uint index,
    IDataObject pDataObject,
    uint grfKeyState,
    out uint pdwEffect
)
int DoDragDrop(
    [InAttribute] unsigned int index, 
    [InAttribute] IDataObject^ pDataObject, 
    [InAttribute] unsigned int grfKeyState, 
    [InAttribute] [OutAttribute] unsigned int% pdwEffect
)
abstract DoDragDrop : 
        index:uint32 * 
        pDataObject:IDataObject * 
        grfKeyState:uint32 * 
        pdwEffect:uint32 byref -> int
function DoDragDrop(
    index : uint, 
    pDataObject : IDataObject, 
    grfKeyState : uint, 
    pdwEffect : uint
) : int

Parameters

  • index
    Type: UInt32

    [in] Specifies the index of the list item of interest.

  • grfKeyState
    Type: UInt32

    [in] Current state of the keyboard and the mouse modifier keys.

  • pdwEffect
    Type: UInt32%

    [in, out] On input, the effect being requested. On output, the effect that your object list allows.

Return Value

Type: Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsObjectList::DoDragDrop(
   [in] ULONG Index,
   [in] IDataObject * pDataObject,
   [in] DWORD grfKeyState,
   [in, out]DWORD * pdwEffect
);

The environment will call QueryDragDrop to see if your object list supports a drag-drop operation. If you return the call indicating that you do support the requested operation, and the user drops pDataObject by releasing the mouse button, the environment calls DoDragDrop. You must then handle the requested action and return the effect in pdwEffect.

This method is very similar to the standard COM Drop method. Values for grfKeyState can be a bitwise "or" combination of any number of the following: MK_CONTROL, MK_SHIFT, MK_ALT, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON. Values for the pdwEffect are taken from the DROPEFFECT enumeration.

.NET Framework Security

See Also

Reference

IVsObjectList Interface

Microsoft.VisualStudio.Shell.Interop Namespace