Initializes the cache with data in a specified format and on a specified medium.
HRESULT SetData(
FORMATETC * pFormatetc, //Pointer to the format of the
// presentation data to be placed in the
// cache
STGMEDIUM * pmedium, //Pointer to the storage medium containing
// the data to be placed in the cache
BOOL fRelease //Ownership of the storage medium after this
// method is completed
);
This method supports the standard return value E_OUTOFMEMORY, as well as the following:
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.
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in oleidl.h.
IDataObject::SetData, IOleCache::Cache, ADVF enumeration