IDataObject::GetCanonicalFormatEtc

Provides a potentially different but logically equivalent FORMATETC structure. You use this method when you have different FORMATETC structures that may return the same data.

HRESULT GetCanonicalFormatEtc(

FORMATETC * pFormatetcIn,
//Points to the FORMATETC structure that the caller would like to use
FORMATETC * pFormatetcOut
//Points to the canonical equivalent FORMATETC structure
);

Parameters

pFormatetcIn

[in]Points to the format, media, and target device that the caller would like to use in a subsequent call to retrieve data, for example, IDataObject::GetData. The TYMED member is not significant and should be ignored.

pFormatetcOut

[out]Points to a FORMATETC structure that is canonically equivalent to pFormatetcIn. The caller allocates this structure and this method fills in the data. In a subsequent call to retrieve data, for example, IDataObject::GetData, the caller uses the pFormatetcOut value. This value is NULL if the method returns DATA_S_SAMEFORMATETC. The TYMED member is not significant and should be ignored.

Return Values

S_OK

The returned FORMATETC structure is different from the one that was passed.

E_INVALIDARG

One or more arguments are invalid.

E_UNEXPECTED

An unexpected error occurred.

E_OUTOFMEMORY

Structure was not created because the system ran out of memory.

DATA_S_SAMEFORMATETC

The FORMATETC structures are the same and NULL is returned in pFormatetcOut.

DV_E_LINDEX

Invalid value for lindex; currently, only -1 is supported.

DV_E_FORMATETC

Invalid value for pFormatetc.

OLE_E_NOTRUNNING

Object application is not running.

Comments

A data object can return exactly the same data even though you have specified different FORMATETC structures in subsequent requests to retrieve data. For example, the same data can be returned for different target devices if the data is not sensitive to the target devices.

The IDataObject::GetCanonicalFormatEtc method provides the canonical equivalent of a specified FORMATETC structure. By calling this function prior to retrieving the data object, you can use the canonical equivalent FORMATETC in your subsequent call to IDataObject::GetData. You can then eliminate unnecessary calls to retrieve data if two different FORMATETC structures have the same canonical equivalent.

If the data object never provides device-specific renderings, the implementation of IDataObject::GetCanonicalFormatEtc simply copies the input FORMATETC to the output FORMATETC, stores a NULL in the ptd field of the output FORMATETC, and returns DATA_S_SAMEFORMATETC.

See Also

IDataObject::GetData, FORMATETC

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database