Compartilhar via


COleDropTarget::OnDragOver

Called by the framework when the cursor is dragged over the window.

virtual DROPEFFECT OnDragOver(
   CWnd* pWnd,
   COleDataObject* pDataObject,
   DWORD dwKeyState,
   CPoint point 
);

Parameters

  • pWnd
    Points to the window that the cursor is over.

  • pDataObject
    Points to the data object that contains the data to be dropped.

  • dwKeyState
    Contains the state of the modifier keys. This is a combination of any number of the following: MK_CONTROL, MK_SHIFT, MK_ALT, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.

  • point
    Contains the current location of the cursor in client coordinates.

Return Value

The effect that would result if a drop were attempted at the location specified by point. It can be one or more of the following:

  • DROPEFFECT_NONE   A drop would not be allowed.

  • DROPEFFECT_COPY   A copy operation would be performed.

  • DROPEFFECT_MOVE   A move operation would be performed.

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

  • DROPEFFECT_SCROLL   Indicates that a drag scroll operation is about to occur or is occurring in the target.

Remarks

This function should be overridden to allow drop operations to occur in the window. The default implementation of this function calls CView::OnDragOver, which returns DROPEFFECT_NONE by default. Because this function is called frequently during a drag-and-drop operation, it should be optimized as much as possible.

For more information, see IDropTarget::DragOver in the Windows SDK.

Example

DROPEFFECT COleContainerView::OnDragOver(COleDataObject* pDataObject, 
   DWORD dwKeyState, CPoint point)
{
   UNREFERENCED_PARAMETER(pDataObject);
   UNREFERENCED_PARAMETER(point);

   DROPEFFECT de = DROPEFFECT_NONE;
   //Determine the type of operation
   if((dwKeyState & MK_SHIFT) && (dwKeyState & MK_CONTROL))
      de = DROPEFFECT_LINK;
   else if(dwKeyState &  MK_CONTROL)
      de = DROPEFFECT_COPY;
   else if(dwKeyState & MK_SHIFT)
      de = DROPEFFECT_MOVE;
   return de;
}

Requirements

Header: afxole.h

See Also

Reference

COleDropTarget Class

Hierarchy Chart

COleDropTarget::OnDragEnter

COleDropTarget::OnDragLeave

COleDropTarget::OnDrop

COleDropTarget::OnDropEx

Other Resources

COleDropTarget Members