IDataObject::GetDataHere

Renders the data described in a FORMATETC structure and transfers it through the STGMEDIUM structure allocated by the caller. You use this method when you want to transfer data from a source object to a target.

HRESULT GetDataHere(

FORMATETC * pFormatetc,
//Points to the data and formats to be transferred
STGMEDIUM * pmedium
//Points to the storage medium in which the returned data is transferred
);

Parameters

pFormatetc

[in]Points to the format, media, and target device to use when passing the data. Only one medium can be specified in TYMED.

The only values valid for TYMED are TYMED_STORAGE, TYMED_STREAM, TYMED_HGLOBAL, or TYMED_FILE.

pmedium

[out]Points to the storage medium containing the the returned data. The medium is allocated by the caller and filled in by IDataObject::GetDataHere. Since the caller allocates the medium, the caller is responsible for freeing the medium. The caller will always get a return value of NULL for the IUnknown specified for releasing the medium.

Return Values

S_OK

Data was successfully retrieved and placed in the storage medium provided.

E_INVALIDARG

One or more arguments are invalid.

E_UNEXPECTED

An unexpected error occurred.

E_OUTOFMEMORY

The system didn't retrieve data because it ran out of memory.

DV_E_LINDEX

Invalid value for lindex; currently, only -1 is supported.

DV_E_FORMATETC

Invalid value for pFormatetc.

DV_E_TYMED

Invalid tymed value.

DV_E_DVASPECT

Invalid dwAspect value.

OLE_E_NOTRUNNING

Object application is not running.

STG_E_MEDIUMFULL

The medium provided by the caller is not large enough to contain the data.

Comments

The IDataObject::GetDataHere method is similar to IDataObject::GetData except that the caller allocates the medium specified in pmedium and is responsible for freeing it. This method copies the data into the actual medium provided by the caller. For example, if the medium is TYMED_HGLOBAL, this method cannot resize the medium or allocate a new hGlobal.

When the transfer medium is a stream, OLE makes assumptions about where the data is being returned and the position of the stream's seek pointer. In a GetData call, the data returned is from stream position zero through just before the current seek pointer of the stream (that is, the position on exit). For GetDataHere, the data returned is from the stream position on entry through just before the position on exit. Note that some media are not appropriate when you are using GetDataHere, including GDI types such as metafiles. The GetDataHere method cannot put data into a caller-provided metafile.

See Also

IDataObject::GetData, FORMATETC, STGMEDIUM

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