IDataObject.GetCanonicalFormatEtc Method

Note: This method is new in the .NET Framework version 2.0.

Provides a standard FORMATETC structure that is logically equivalent to a more complex structure. Use this method to determine whether two different FORMATETC structures would return the same data, removing the need for duplicate rendering.

Namespace: System.Runtime.InteropServices.ComTypes
Assembly: System (in system.dll)

int GetCanonicalFormatEtc (
	[InAttribute] ref FORMATETC formatIn,
	out FORMATETC formatOut
int GetCanonicalFormatEtc (
	/** @attribute InAttribute() */ /** @ref */ FORMATETC formatIn, 
	/** @attribute OutAttribute() */ /** @ref */ FORMATETC formatOut
JScript does not support passing value-type arguments by reference.



A pointer to a FORMATETC structure, passed by reference, that defines the format, medium, and target device that the caller would like to use to retrieve data in a subsequent call such as GetData. The TYMED member is not significant in this case and should be ignored.


When this method returns, contains a pointer to a FORMATETC structure that contains the most general information possible for a specific rendering, making it canonically equivalent to formatetIn. The caller must allocate this structure and the GetCanonicalFormatEtc method must fill in the data. To retrieve data in a subsequent call such as GetData, the caller uses the supplied value of formatOut, unless the value supplied is a null reference (Nothing in Visual Basic). This value is a null reference (Nothing in Visual Basic) if the method returns DATA_S_SAMEFORMATETC. The TYMED member is not significant in this case and should be ignored. This parameter is passed uninitialized.

Return Value

This method supports the standard return values E_INVALIDARG, E_UNEXPECTED, and E_OUTOFMEMORY, as well as the following:




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


The FORMATETC structures are the same and a null reference (Nothing in Visual Basic) is returned in the formatOut parameter.


There is an invalid value for lindex; currently, only -1 is supported.


There is an invalid value for the pFormatetc parameter.


The application is not running.

For more information about IDataObject::GetCanonicalFormatEtc, see the MSDN Library.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions