IOleCache::SetData

Initializes the cache with data in a specified format and on a specified medium.

HRESULT SetData(

FORMATETC * pFormatetc,
//Points to the format of the presentation data to be placed in the cache
STGMEDIUM * pmedium,
//Points to the storage medium containing the data to be placed in the cache
BOOL fRelease
//Indicates ownership of the storage medium after this method is completed
);

Parameters

pFormatetc

[in] Points to the format of the presentation data being placed in the cache.

pmedium

[in] Points to the storage medium that contains the presentation data.

fRelease

[in] Indicates ownership of the storage medium after completion of the method. If fRelease is TRUE, the cache takes ownership, freeing the medium when it is finished using it. When fRelease is FALSE, the caller retains ownership and is responsible for freeing the medium. The cache can only use the storage medium for the duration of the call.

Return Values

S_OK

The cache was filled.

E_OUTOFMEMORY

The cache could not be filled due to a lack of memory.

DV_E_LINDEX

The value is not valid for pFormatetc->lindex. Currently, only -1 is supported.

DV_E_FORMATETC

The FORMATETC structure is invalid.

DV_E_TYMED

The value is not valid for pFormatetc->tymed.

DV_E_DVASPECT

The value is not valid for pFormatetc->dwAspect.

OLE_E_BLANK

Uninitialized object.

DV_E_TARGETDEVICE

The object is static and pFormatetc->ptd is non-NULL.

STG_E_MEDIUMFULL

The storage medium is full.

Comments

IOleCache::SetData
is usually called when an object is created from the Clipboard or through a drag-and-drop operation and Embed Source data is used to create the object.

IOleCache::SetData and IOleCache::InitCache are very similar. There are two main differences. The first difference is that while IOleCache::InitCache initializes the cache with the any presentation format provided by the data object, IOleCache::SetData initializes it with a single format. Second, the IOleCache::SetData method ignores the ADVF_NODATA flag while IOleCache::InitCache obeys this flag.

A container can use this method to maintain a single aspect of an object, such as the icon aspect of the object.

See Also

IDataObject::SetData, IOleCache::Cache

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