共用方式為


COleDataSource Class

Acts as a cache into which an application places the data that it will offer during data transfer operations, such as Clipboard or drag-and-drop operations.

class COleDataSource : public CCmdTarget

Members

Public Constructors

Name

Description

COleDataSource::COleDataSource

Constructs a COleDataSource object.

Public Methods

Name

Description

COleDataSource::CacheData

Offers data in a specified format using a STGMEDIUM structure.

COleDataSource::CacheGlobalData

Offers data in a specified format using an HGLOBAL.

COleDataSource::DelayRenderData

Offers data in a specified format using delayed rendering.

COleDataSource::DelayRenderFileData

Offers data in a specified format in a CFile pointer.

COleDataSource::DelaySetData

Called for every format that is supported in OnSetData.

COleDataSource::DoDragDrop

Performs drag-and-drop operations with a data source.

COleDataSource::Empty

Empties the COleDataSource object of data.

COleDataSource::FlushClipboard

Renders all data to the Clipboard.

COleDataSource::GetClipboardOwner

Verifies that the data placed on the Clipboard is still there.

COleDataSource::OnRenderData

Retrieves data as part of delayed rendering.

COleDataSource::OnRenderFileData

Retrieves data into a CFile as part of delayed rendering.

COleDataSource::OnRenderGlobalData

Retrieves data into an HGLOBAL as part of delayed rendering.

COleDataSource::OnSetData

Called to replace the data in the COleDataSource object.

COleDataSource::SetClipboard

Places a COleDataSource object on the Clipboard.

Remarks

You can create OLE data sources directly. Alternately, the COleClientItem and COleServerItem classes create OLE data sources in response to their CopyToClipboard and DoDragDrop member functions. See COleServerItem::CopyToClipboard for a brief description. Override the OnGetClipboardData member function of your client item or server item class to add additional Clipboard formats to the data in the OLE data source created for the CopyToClipboard or DoDragDrop member function.

Whenever you want to prepare data for a transfer, you should create an object of this class and fill it with your data using the most appropriate method for your data. The way it is inserted into a data source is directly affected by whether the data is supplied immediately (immediate rendering) or on demand (delayed rendering). For every Clipboard format in which you are providing data by passing the Clipboard format to be used (and an optional FORMATETC structure), call DelayRenderData.

For more information about data sources and data transfer, see the article Data Objects and Data Sources (OLE). In addition, the article Clipboard Topics describes the OLE Clipboard mechanism.

Inheritance Hierarchy

CObject

CCmdTarget

COleDataSource

Requirements

Header: afxole.h

See Also

Reference

CCmdTarget Class

Hierarchy Chart

COleDataObject Class

Concepts

MFC Sample HIERSVR

MFC Sample OCLIENT