SHDoDragDrop function
Executes a drag-and-drop operation. Supports drag source creation on demand, as well as drag images.
Syntax
HRESULT SHDoDragDrop( _In_ HWND hwnd, _In_ IDataObject *pdtobj, _In_ IDropSource *pdsrc, _In_ DWORD dwEffect, _Out_ DWORD *pdwEffect );
Parameters
- hwnd [in]
-
Type: HWND
The handle of the window used to obtain the drag image. This value can be NULL. See Remarks for more details.
- pdtobj [in]
-
Type: IDataObject*
A pointer to the IDataObject interface on a data object that contains the data being dragged.
- pdsrc [in]
-
Type: IDropSource*
A pointer to an implementation of the IDropSource interface, which is used to communicate with the source during the drag operation.
As of Windows Vista, if this value is NULL, the Shell creates a drop source object for you.
- dwEffect [in]
-
Type: DWORD
The effects that the source allows in the drag-and-drop operation. The most significant effect is whether the drag-and-drop operation permits a move. For a list of possible values, see DROPEFFECT.
- pdwEffect [out]
-
Type: DWORD*
A pointer to a value that indicates how the drag-and-drop operation affected the source data. The pdwEffect parameter is set only if the operation is not canceled. For a list of possible values, see DROPEFFECT.
Return value
Type: HRESULT
This function supports the standard return value E_OUTOFMEMORY, as well as the following values:
| Return code | Description |
|---|---|
|
The drag-and-drop operation was successful. |
|
The drag-and-drop operation was canceled. |
|
Unexpected error occurred. |
Remarks
As of Windows Vista, if a drag image is not already stored in the data object pdtobj and a drag image cannot be obtained from the window specified by hwnd, the Shell provides a generic drag image. A drag image can fail to be obtained from the specified window either because hwnd is NULL or the specified window does not support the DI_GETDRAGIMAGE message.
Requirements
|
Minimum supported client |
Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|