Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This interface specifies methods that enable 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 IDataObjectinterface specifies methods for enumerating available formats and managing connections to advisory sinks for handling change notifications.

The term data objectis used to mean any object that supports an implementation of the IDataObjectinterface.

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.

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 IDataObjectinterface 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 IDataObjectinterface.

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 IDataObjectinterface.

When you call the data transfer methods in the IDataObjectinterface, 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 IDataObjectadvisory methods to set up an advisory connection through which notifications can be sent.

Methods

The following table shows the methods for this interface in the order that the compiler calls the methods. Like all COM interfaces, this interface inherits the methods for the IUnknowninterface.

IUnknown method Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IDataObject method Description

GetData

Renders the data described in a FORMATETCstructure and transfers it through the STGMEDIUMstructure.

GetDataHere

Renders the data described in a FORMATETCstructure and transfers it through the STGMEDIUMstructure allocated by the caller.

QueryGetData

Determines whether the data object is capable of rendering the data described in the FORMATETCstructure.

GetCanonicalFormatEtc

Provides a potentially different but logically equivalent FORMATETCstructure.

SetData

Provides the source data object with data described by a FORMATETCstructure and an STGMEDIUMstructure.

EnumFormatEtc

Creates and returns a pointer to an object to enumerate the FORMATETCstructure supported by the data object.

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 DAdvisemethod.

EnumDAdvise

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

Remarks

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

Header objidl.h, objidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later