IDataObject有个方法GetData
其声明如下
HRESULT GetData(
FORMATETC * pFormatetc, //Pointer to the FORMATETC structure
STGMEDIUM * pmedium //Pointer to the STGMEDIUM structure
);对于STGMEDIUM结构的说明,MSDN上的资料如下:
STGMEDIUM
The STGMEDIUM structure is a generalized global memory handle used for data transfer operations by the IAdviseSink, IDataObject, and IOleCache interfaces.typedef struct tagSTGMEDIUM
{
DWORD tymed;
[switch_type(DWORD), switch_is((DWORD) tymed)]
union {
[case(TYMED_GDI)] HBITMAP hBitmap;
[case(TYMED_MFPICT)] HMETAFILEPICT hMetaFilePict;
[case(TYMED_ENHMF)] HENHMETAFILE hEnhMetaFile;
[case(TYMED_HGLOBAL)] HGLOBAL hGlobal;
[case(TYMED_FILE)] LPWSTR lpszFileName;
[case(TYMED_ISTREAM)] IStream *pstm;
[case(TYMED_ISTORAGE)] IStorage *pstg;
[default] ;
};
[unique] IUnknown *pUnkForRelease;
}STGMEDIUM;
typedef STGMEDIUM *LPSTGMEDIUM;
Members
tymed
Type of storage medium. The marshaling and unmarshaling routines use this value to determine which union member was used. This value must be one of the elements of the TYMED enumeration.
union member
Handle, string, or interface pointer that the receiving process can use to access the data being transferred. If tymed is TYMED_NULL, the union member is undefined; otherwise, it is one of the following:
hBitmapBitmap handle. The tymed member is TYMED_GDI.hMetaFilePictMetafile handle. The tymed member is TYMED_MFPICT.hEnhMetaFileEnhanced metafile handle. The tymed member is TYMED_ENHMF.hGlobalGlobal memory handle. The tymed member is TYMED_HGLOBAL.lpszFileNamePointer to the path of a disk file that contains the data. The tymed member is TYMED_FILE.pstmPointer to an IStream interface. The tymed member is TYMED_ISTREAM.pstgPointer to an IStorage interface. The tymed member is TYMED_ISTORAGE.pUnkForRelease
Pointer to an interface instance that allows the sending process to control the way the storage is released when the receiving process calls the ReleaseStgMedium function. If pUnkForRelease is NULL, ReleaseStgMedium uses default procedures to release the storage; otherwise, ReleaseStgMedium uses the specified IUnknown interface. 但是,对于hGlobal类型,那块内存数据的具体格式却没讲,
我现在是想做OLE拖动,也就是从桌面,或者资源管理器里面拖文件到我的程序的主窗口
希望获得拖动的文件的信息。
所以很希望知道hGlobal的具体格式说明!谢谢了,解决问题后200分丰上。
其声明如下
HRESULT GetData(
FORMATETC * pFormatetc, //Pointer to the FORMATETC structure
STGMEDIUM * pmedium //Pointer to the STGMEDIUM structure
);对于STGMEDIUM结构的说明,MSDN上的资料如下:
STGMEDIUM
The STGMEDIUM structure is a generalized global memory handle used for data transfer operations by the IAdviseSink, IDataObject, and IOleCache interfaces.typedef struct tagSTGMEDIUM
{
DWORD tymed;
[switch_type(DWORD), switch_is((DWORD) tymed)]
union {
[case(TYMED_GDI)] HBITMAP hBitmap;
[case(TYMED_MFPICT)] HMETAFILEPICT hMetaFilePict;
[case(TYMED_ENHMF)] HENHMETAFILE hEnhMetaFile;
[case(TYMED_HGLOBAL)] HGLOBAL hGlobal;
[case(TYMED_FILE)] LPWSTR lpszFileName;
[case(TYMED_ISTREAM)] IStream *pstm;
[case(TYMED_ISTORAGE)] IStorage *pstg;
[default] ;
};
[unique] IUnknown *pUnkForRelease;
}STGMEDIUM;
typedef STGMEDIUM *LPSTGMEDIUM;
Members
tymed
Type of storage medium. The marshaling and unmarshaling routines use this value to determine which union member was used. This value must be one of the elements of the TYMED enumeration.
union member
Handle, string, or interface pointer that the receiving process can use to access the data being transferred. If tymed is TYMED_NULL, the union member is undefined; otherwise, it is one of the following:
hBitmapBitmap handle. The tymed member is TYMED_GDI.hMetaFilePictMetafile handle. The tymed member is TYMED_MFPICT.hEnhMetaFileEnhanced metafile handle. The tymed member is TYMED_ENHMF.hGlobalGlobal memory handle. The tymed member is TYMED_HGLOBAL.lpszFileNamePointer to the path of a disk file that contains the data. The tymed member is TYMED_FILE.pstmPointer to an IStream interface. The tymed member is TYMED_ISTREAM.pstgPointer to an IStorage interface. The tymed member is TYMED_ISTORAGE.pUnkForRelease
Pointer to an interface instance that allows the sending process to control the way the storage is released when the receiving process calls the ReleaseStgMedium function. If pUnkForRelease is NULL, ReleaseStgMedium uses default procedures to release the storage; otherwise, ReleaseStgMedium uses the specified IUnknown interface. 但是,对于hGlobal类型,那块内存数据的具体格式却没讲,
我现在是想做OLE拖动,也就是从桌面,或者资源管理器里面拖文件到我的程序的主窗口
希望获得拖动的文件的信息。
所以很希望知道hGlobal的具体格式说明!谢谢了,解决问题后200分丰上。
最起码,要有Windows系统内的文件拖放的说明。
98是单字符,2000是宽字符。
我现在需要知道不单是文件拖放,例如你说的Html拖放等等的格式,
我需要这一系列的说明。