Home   Index   About
Ultimate Pack


Custom Search
IDataObject::EnumFormatEtc

Returns an object to enumerate the FORMATETC structures that can be used with IDataObject::GetData or IDataObject::SetData. You use this method when you want to enumerate the FORMATETC structures for a data object.

HRESULT EnumFormatEtc(

DWORD dwDirection,
//Specifies a value from the enumeration DATADIR
IEnumFORMATETC ** ppenumFormatetc
//Location for IEnumFORMATETC
);

Parameters

dwDirection

[in]Specifies a value from the enumeration DATADIR.

typedef enum tagDATADIR

{

DATADIR_GET = 1,

DATADIR_SET = 2,

} DATADIR;

The value DATADIR_GET enumerates the formats that can be passed in IDataObject::GetData. The value DATADIR_SET enumerates those formats that can be passed in IDataObject::SetData.

ppenumFormatetc

[out]Points to the location where the new enumerator object should be returned.

Return Values

S_OK

Enumerator object was successfully returned.

E_INVALIDARG

One or more arguments are invalid.

E_OUTOFMEMORY

Enumerator object was not returned because the system ran out of memory.

E_NOTIMPL

The direction specified by dwDirection is not supported.

OLE_S_USEREG

Requests that OLE enumerate the formats from the registry.

Comments

This method creates and returns an enumerator object that can be used to determine all of the ways the data object can describe data in a FORMATETC structure. The enumerator object implements IEnumFORMATETC, one of the standard enumerator interfaces. The caller is responsible for calling IEnumFormatEtc::Release when it is finished with the enumeration.

If a FORMATETC structure is enumerated by IDataObject::EnumFormatEtc, there is no guarantee that the format is supported because the formats can change over time. Accordingly, applications should treat the enumeration as a hint of the format types that can be passed.

IDataObject::EnumFormatEtc is called when one of the following actions occurs:

  • An application calls OleSetClipboard. OLE must determine what data to place on the Clipboard and whether it is necessary to put OLE 1 compatibility formats on the Clipboard.

  • Data is being pasted from the Clipboard or dropped. An application uses the first acceptable format.

  • The Paste Special dialog box is displayed. The target application builds the list of formats from the FORMATETC entries.

Formats can be registered statically in the registration database or dynamically during object initialization. If an object has an unchanging list of formats and these formats are registered in the registration database, it can ask OLE to perform the enumeration using the registration database by calling the helper function OleRegEnumFormatEtc or by returning OLE_S_USEREG.

OLE_S_USEREG instructs the default object handler to call OleRegEnumFormatEtc. Object applications that are implemented as DLL object applications cannot return OLE_S_USEREG. They must call OleRegEnumFormatEtc directly.

Private formats can be enumerated for OLE 1 objects, if they are registered with the RequestDataFormats or SetDataFormats keys in the registration database. Also, private formats can be enumerated for OLE 2 objects, if they are registered with the GetDataFormats or SetDataFormats keys.

For OLE 1 objects whose servers do not have RequestDataFormats or SetDataFormats information registered in the registration database, a call to EnumFormatEtc with DATADIR_GET only enumerates the Native and Metafile formats, regardless of whether they support these formats or others. Calling EnumFormatEtc with DATADIR_SET on such objects only enumerates Native, regardless of whether the object supports being set with other formats.

The FORMATETC structure returned by the enumeration usually indicates a NULL target device (ptd). This is appropriate because, unlike the other members of FORMATETC, the target device does not participate in the object's decision as to whether it can accept or provide the data in either a SetData or GetData call.

The TYMED member of FORMATETC often indicates that more than one kind of storage medium is acceptable. You should always mask and test for it by using a Boolean OR operator.

See Also

FORMATETC, OleRegEnumFormatEtc, IEnumFormatEtc, IDataObject::SetData, IDataObject::GetData


Last news from Greatis Software

Nostalgia .Net     Nostalgia .Net     .Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes.  More »

Recommended software for developers

Ultimate Pack for Delphi and C++ Builder     Ultimate Pack     Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price.  More »

Form Designer .Net     Form Designer .Net     Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro!  More »

Print Suite .Net     Print Suite .Net     Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available  More »

Gradient Controls .Net     Gradient Controls .Net     Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available  More »

iGrid     Greatis iGrid     iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors.  More »


All the contacts and projects

Dmitry Vasiliev (just.dmitry)

Related Links

Software for Visual Studio .NET developers
Software for Delphi and C++ Builder developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference
Win32 Multimedia Programmer's Reference
OLE Programmer's Reference
Microsoft Windows Pen API Programmer's Reference
Microsoft Windows Sockets 2 Reference
Microsoft Windows Telephony API (TAPI) Programmer's Reference
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008-2012 Free Tech Secrets ;) greatis just4fun network just4fun