IOleCache::SetData method (oleidl.h)
Initializes the cache with data in a specified format and on a specified medium.
HRESULT SetData( [in] FORMATETC *pformatetc, [in] STGMEDIUM *pmedium, [in] BOOL fRelease );
A pointer to a FORMATETC structure that specifies the format of the presentation data being placed in the cache.
A pointer to a STGMEDIUM structure that specifies the storage medium that contains the presentation data.
Indicates the 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.
This method returns S_OK on success. Other possible return values include the following.
||The value is not valid for pformatetc->lindex. Currently, only -1 is supported.|
||The FORMATETC structure is invalid.|
||The value is not valid for pformatetc->tymed.|
||The value is not valid for pformatetc->dwAspect.|
||There is an uninitialized object.|
||The object is static and pformatetc->ptd is non-NULL.|
||The storage medium is full.|
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 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.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|