The FORMATETC structure is a generalized clipboard format, enhanced to encompass a target device, an aspect or view of the data, and a storage medium. A data consumer, such as an OLE container application, passes the FORMATETC structure as an argument in calls to IDataObject to indicate the type of data it wants from a data source, such as a compound document object. The source uses the FORMATETC structure to describe what formats it can provide.
FORMATETC can describe virtually any data, including other objects such as monikers. A container can ask one of its embedded objects to list its data formats by calling IDataObject::EnumFormatEtc, which returns an enumerator object that implements the IEnumFORMATETC interface. Instead of replying merely that it has "text and a bitmap," the object can provide a detailed description of the data, including the device (normally screen or printer) for which it is rendered, the aspect to be presented to the user (full contents, thumbnail, icon, or formatted for printing), and the storage medium containing the data (global memory, disk file, storage object, or stream). This ability to tightly describe data will, in time, result in higher quality printer and screen output as well as more efficiency in data browsing, where a thumbnail sketch is much faster to retrieve and display than a fully detailed rendering.
The following table lists fields of the FORMATETC data structure and the information that they specify.
Field
Specifies
cfFormat
The format in which the data is to be rendered, which can be a standard clipboard format, a proprietary format, or an OLE format. For more information on OLE formats, see Compound Documents.
ptd
A DVTARGETDEVICE structure, which contains enough information about a Windows target device, such as a screen or printer, so that a handle to its device context (hDC) can be created using the CreateDC function.
dwAspect
The aspect or view of the data to be rendered; can be the full contents, a thumbnail sketch, an icon, or formatted for printing.
lindex
The part of the aspect that is of interest; for the present, the value must be -1, indicating that the entire view is of interest.
tymed
The data's storage medium, which can be global memory, disk file, or an instance of one of COM's structured-storage interfaces.
Extended data types (EDTs) and base enumerations (enums) are data types that are created and managed in the development environment. Base enums represent a list of literals, while EDTs are reusable data types that have a specific definition. The Application Object Tree (AOT) in finance and operations apps contains many existing EDTs and base enums that can be extended for use in your project, or you can create new data types. This module will focus on creating new data types.