IDataObject interface

Enables data transfer and notification of changes in data. Data transfer methods specify the format of the transferred data along with the medium through which the data is to be transferred. Optionally, the data can be rendered for a specific target device. In addition to methods for retrieving and storing data, the IDataObject interface specifies methods for enumerating available formats and managing connections to advisory sinks for handling change notifications.

The term data object is used to mean any object that supports an implementation of the IDataObject interface. Implementations vary, depending on what the data object is required to do; in some data objects, the implementation of certain methods not supported by the object could simply be the return of E_NOTIMPL. For example, some data objects do not allow callers to send them data. Other data objects do not support advisory connections and change notifications. However, for those data objects that do support change notifications, OLE provides an object called a data advise holder. An interface pointer to this holder is available through a call to the helper function CreateDataAdviseHolder. A data object can have multiple connections, each with its own set of attributes. The OLE data advise holder simplifies the task of managing these connections and sending the appropriate notifications.

Methods

The IDataObject interface has these methods.

Method Description
IDataObject::DAdvise Called by an object supporting an advise sink to create a connection between a data object and the advise sink. This enables the advise sink to be notified of changes in the data of the object.
IDataObject::DUnadvise Destroys a notification connection that had been previously set up.
IDataObject::EnumDAdvise Creates an object that can be used to enumerate the current advisory connections.
IDataObject::EnumFormatEtc Creates an object to enumerate the formats supported by a data object.
IDataObject::GetCanonicalFormatEtc Provides a potentially different but logically equivalent FORMATETC structure. You use this method to determine whether two different FORMATETC structures would return the same data, removing the need for duplicate rendering.
IDataObject::GetData Called by a data consumer to obtain data from a source data object.
IDataObject::GetDataHere Called by a data consumer to obtain data from a source data object. This method differs from the GetData method in that the caller must allocate and free the specified storage medium.
IDataObject::QueryGetData Determines whether the data object is capable of rendering the data as specified. Objects attempting a paste or drop operation can call this method before calling IDataObject::GetData to get an indication of whether the operation may be successful.
IDataObject::SetData Called by an object containing a data source to transfer data to the object that implements this method.

Requirements

   
Windows version Windows 2000 Professional [desktop apps UWP apps] Windows 2000 Server [desktop apps UWP apps]
Target Platform Windows
Header objidl.h