9.6.2 OleGetData

OLESTATUS OleGetData(lpObject, cfFormat, phData)

LPOLEOBJECT lpObject;

OLECLIPFORMAT cfFormat;

HANDLE FAR * phData;

The OleGetData function retrieves data in the requested format from the specified object and supplies a handle to a memory or graphical device interface (GDI) object containing the data.

Parameter Description

lpObject Points to the object from which data is retrieved.
cfFormat Specifies the format in which data is returned. This parameter can be one of the predefined clipboard formats or the value returned by the RegisterClipboardFormat function.
phData Points to the handle of a memory object that contains the data when the function returns.

If the OleGetData function returns OLE_WARN_DELETE_DATA, the client application owns the data and should free the memory associated with the data when the client application has finished using it. For other return values the client should not free the memory or modify the data, because the data is controlled by the client DLL. If the application needs the data for long-term use, it should copy the data.

The OleGetData function typically returns OLE_WARN_DELETE_DATA if an object handler generates data for an object that the client DLL cannot interpret. In this case, the client application is responsible for controlling that data.

When the OleGetData function specifies CF_METAFILE or CF_BITMAP, the phData parameter points to a GDI object, not a memory object, when the function returns. OleGetData supplies a handle to a memory object for all other formats.

If the function is successful, the return value is OLE_OK; otherwise, it is an error value, which may be one of the following:

OLE_BUSY

OLE_ERROR_BLANK

OLE_ERROR_FORMAT

OLE_WARN_DELETE_DATA

OLE_WAIT_FOR_RELEASE

See AlsoOleEnumFormats, OleSetData, RegisterClipboardFormat