Compartilhar via


IDataObject:IUnknown (Windows CE 5.0)

Send Feedback

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

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.

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 IUnknown interface.

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 FORMATETC structure and transfers it through the STGMEDIUM structure.
GetDataHere Renders the data described in a FORMATETC structure and transfers it through the STGMEDIUM structure allocated by the caller.
QueryGetData Determines whether the data object is capable of rendering the data described in the FORMATETC structure.
GetCanonicalFormatEtc Provides a potentially different but logically equivalent FORMATETC structure.
SetData Provides the source data object with data described by a FORMATETC structure and an STGMEDIUM structure.
EnumFormatEtc Creates and returns a pointer to an object to enumerate the FORMATETC structure 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 DAdvise method.
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

OS Versions: Windows CE 3.0 and later.
Header: Objidl.h, Objidl.idl.
Link Library: Ole32.lib, Uuid.lib.

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.