Compartilhar via


CMFCToolBarButton::PrepareDrag

Called by the framework when the button is about to perform a drag-and-drop operation.

virtual BOOL PrepareDrag(
   COleDataSource& srcItem
);

Parameters

  • [in] srcItem
    A COleDataSource object that stores state information about the drag-and-drop operation.

Return Value

TRUE if the operation succeeds; otherwise FALSE.

Remarks

The framework calls this method to prepare the toolbar button to store its state in the provided COleDataSource object. This method stores its state by serializing itself to a shared file and then passing that file to the COleDataSource::CacheGlobalData method. For more information about toolbar button serialization, see CMFCToolBarButton::Serialize.

This method does nothing and returns TRUE if the button cannot be stored (the CMFCToolBarButton::CanBeStored method returns FALSE). It returns FALSE if an exception occurs during object serialization.

For more information about OLE drag-and-drop operations, see Drag and Drop (OLE).

Requirements

Header: afxtoolbarbutton.h

See Also

Reference

CMFCToolBarButton Class

Hierarchy Chart

COleDataSource Class

CMFCToolBarButton::CanBeStored

CMFCToolBarButton::Serialize

Concepts

Drag and Drop (OLE)