IDataObject::GetCanonicalFormatEtc
Provides a
standard FORMATETC
HRESULT GetCanonicalFormatEtc(
FORMATETC
* pFormatetcIn, |
//Pointer to the FORMATETC structure |
FORMATETC
* pFormatetcOut |
//Pointer to the canonical equivalent FORMATETC
structure |
); |
|
Parameters
pFormatetcIn
[in] Pointer
to the FORMATETC structure that defines the format, medium, and target device
that the caller would like to use to retrieve data in a subsequent call such as
IDataObject::GetData
pFormatetcOut
[out] Pointer
to a FORMATETC
Return Values
This method
supports the standard return values E_INVALIDARG, E_UNEXPECTED, and
E_OUTOFMEMORY, as well as the following:
S_OK
The returned FORMATETC
DATA_S_SAMEFORMATETC
The FORMATETC
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.
Remarks
If a data
object can supply exactly the same data for more than one requested FORMATETC
Notes to Callers
A call to
this method can determine whether two calls to IDataObject::GetData on a
data object, specifying two different FORMATETC structures, would actually
produce the same renderings, thus eliminating the need for the second call and
improving performance. If the call to GetCanonicalFormatEtc results in a
canonical format being written to the pFormatetcOut parameter, the
caller then uses that structure in a subsequent call to IDataObject::GetData
Notes to Implementers
Conceptually,
it is possible to think of FORMATETC structures in groups defined by a
canonical FORMATETC that provides the same results as each of the group
members. In constructing the canonical FORMATETC, you should make sure it
contains the most general information possible that still produces a specific
rendering.
For data
objects that never provide device-specific renderings, the simplest implementation
of this method is to copy the input FORMATETC to the output FORMATETC,
store a NULL in the ptd field of the output FORMATETC, and return
DATA_S_SAMEFORMATETC.
See Also