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.

When to implement

Implement the IDataObject interface if you are developing a container or server application that is capable of transferring data. For example, if your application allows its data to be pasted or dropped into another application, you must implement the IDataObject interface. OLE compound document object servers that support objects that can be embedded or linked must implement IDataObject.

OLE provides implementations in its default object handler and its cache.

When to use

Any object that can receive data calls the methods in the IDataObject interface.

When you call the data transfer methods in the IDataObject interface, you specify a format, a medium, and, optionally, a target device for which the data should be rendered. Objects, such as containers, that want to be notified through their advise sinks when the data in the data object changes call the IDataObject advisory methods to set up an advisory connection through which notifications can be sent.

Members

The IDataObject interface inherits from the IUnknown interface. IDataObject also has these types of members:

Methods

The IDataObject interface has these methods.

MethodDescription
DAdvise

Creates a connection between a data object and an advise sink so the advise sink can receive notifications of changes in the data object.

DUnadvise

Destroys a notification previously set up with the DAdvise method.

EnumDAdvise

Creates and returns a pointer to an object to enumerate the current advisory connections.

EnumFormatEtc

Creates an object to enumerate the formats supported by a data object.

GetCanonicalFormatEtc

Provides a potentially different but logically equivalent FORMATETC structure.

GetData

Called by a data consumer to obtain data from a source data object.

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.

QueryGetData

Determines whether the data object is capable of rendering the data as specified.

SetData

Called by an object containing a data source to transfer data to the object that implements this method.

 

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]

Header

ObjIdl.h

IDL

ObjIdl.idl

IID

IID_IDataObject is defined as 0000010e-0000-0000-C000-000000000046

 

 

Community Additions

ADD
Show:
© 2014 Microsoft