다음을 통해 공유


COleDataSource::DoDragDrop

Call the DoDragDrop member function to perform a drag-and-drop operation for this data source, typically in an CWnd::OnLButtonDown handler.

DROPEFFECT DoDragDrop(
   DWORD dwEffects = DROPEFFECT_COPY|DROPEFFECT_MOVE|DROPEFFECT_LINK,
   LPCRECT lpRectStartDrag = NULL,
   COleDropSource* pDropSource = NULL 
);

Parameters

  • dwEffects
    Drag-and-drop operations that are allowed on this data source. Can be one or more of the following:

    • DROPEFFECT_COPY   A copy operation could be performed.

    • DROPEFFECT_MOVE   A move operation could be performed.

    • DROPEFFECT_LINK   A link from the dropped data to the original data could be established.

    • DROPEFFECT_SCROLL   Indicates that a drag scroll operation could occur.

  • lpRectStartDrag
    Pointer to the rectangle that defines where the drag actually starts. For more information, see the following Remarks section.

  • pDropSource
    Points to a drop source. If NULL then a default implementation of COleDropSource will be used.

Return Value

Drop effect generated by the drag-and-drop operation; otherwise DROPEFFECT_NONE if the operation never begins because the user released the mouse button before leaving the supplied rectangle.

Remarks

The drag-and-drop operation does not start immediately. It waits until the mouse cursor leaves the rectangle specified by lpRectStartDrag or until a specified number of milliseconds have passed. If lpRectStartDrag is NULL, the size of the rectangle is one pixel.

The delay time is specified by a registry key setting. You can change the delay time by calling CWinApp::WriteProfileString or CWinApp::WriteProfileInt. If you do not specify the delay time, a default value of 200 milliseconds is used. Drag delay time is stored as follows:

  • Windows NT   Drag delay time is stored in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\NT\CurrentVersion\IniFileMapping\win.ini\Windows\DragDelay.

  • Windows 3.x   Drag delay time is stored in the WIN.INI file, under the [Windows} section.

  • Windows 95/98   Drag delay time is stored in a cached version of WIN.INI.

For more information about how drag delay information is stored in either the registry or the .INI file, see WriteProfileString in the Windows SDK.

For more information, see the article Drag and Drop: Implementing a Drop Source.

Requirements

Header: afxole.h

See Also

Reference

COleDataSource Class

Hierarchy Chart

COleDropSource::OnBeginDrag

COleDropSource Class

Other Resources

COleDataSource Members