TOleContainer
我正在尝试使用 IDataObject 的 GetData 方法提取位图。
OleContainer1.CreateObject('Paint.Picture', false);
OleContainer1.OleObjectInterface.QueryInterface(IDataObject, DataObject);
EnumFormatEtc with DATADIR_GET
on DataObject 返回以下内容:
cfFormat, ptd, dwAspect, lIndex, tymed
CF_METAFILEPICT, nil, DVASPECT_CONTENT, -1, TYMED_MFPICT
CF_DIB, nil, DVASPECT_CONTENT, -1, TYMED_HGLOBAL or TYMED_ISTREAM
CF_BITMAP, nil, DVASPECT_CONTENT, -1, TYMED_HGLOBAL
但是当我这样做时:
FormatEtc.cfFormat := CF_BITMAP;
FormatEtc.ptd := nil;
FormatEtc.dwAspect := DVASPECT_CONTENT;
FormatEtc.lIndex := -1;
FormatEtc.tymed := TYMED_HGLOBAL;
OleCheck(DataObject.GetData(FormatEtc, StorageMedium));
我收到无效的 FORMATETC 结构错误。我究竟做错了什么?