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 is used to enumerate an array of FORMATETCstructures. IEnumFORMATETChas the same methods as all enumerator interfaces: Next, Skip, Reset, and Clone.

When to Implement

IEnumFORMATETCmust be implemented by all data objects to support calls to the IDataObject::EnumFormatEtcmethod, which supplies a pointer to the enumerator's IEnumFORMATETCinterface. If the data object supports a different set of FORMATETCinformation depending on the direction of the data (whether a call is intended for the SetDataor GetDatamethod of IDataObject), the implementation of IEnumFORMATETCmust be able to operate on both.

The order of formats enumerated through the IEnumFORMATETCobject should be the same as the order that the formats would be in when placed on the Clipboard. Typically, this order starts with private data formats and ends with presentation formats, such as CF_METAFILEPICT.

When to Use

Call the methods of IEnumFORMATETCwhen you need to enumerate the FORMATETCstructures defining the formats and media supported by a given data object.

This is necessary in most data transfer operations, such as Clipboard and drag-and-drop, so the object on the other end of the data transfer can determine whether the appropriate format and media for the data is supported.

Note To Implementers

If the IEnumFORMATETC::Nextmethod returns a non-NULL DVTARGETDEVICE pointer in the ptdmember of the FORMATETCstructure, it must be allocated with the CoTaskMemAllocfunction (or its equivalent).

Note to Callers

If the IEnumFORMATETC::Nextmethod returns a non-NULL DVTARGETDEVICE pointer in the ptdmember of the FORMATETCstructure, the memory must be freed with the CoTaskMemFreefunction (or its equivalent).

Failure to do so will result in a memory leak.

Methods

The following table shows the methods for this interface in alphabetical order.

IEnumFORMATETC method Description

Clone

Creates another enumerator that contains the same enumeration state as the current enumerator.

Next

Retrieves the next celtitems in the enumeration sequence.

Reset

Resets the enumeration sequence to the beginning.

Skip

Skips over the next specified number of elements in the enumeration sequence.

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

See Also