描述:
HRESULT SetData(
FORMATETC * pFormatetc, //Pointer to the FORMATETC structure
STGMEDIUM * pmedium, //Pointer to STGMEDIUM structure
BOOL fRelease //Indicates which object owns the storage
// medium after the call is completed
下面这句怎么翻译:
fRelease
[in] If TRUE, the data object called, which implements IDataObject::SetData, owns the storage medium after the call returns. This means it must free the medium after it has been used by calling the ReleaseStgMedium function. If FALSE, the caller retains ownership of the storage medium and the data object called uses the storage medium for the duration of the call only.
解决方案1:
如果fRelease==TRUE,表示当对SetData()函数调用结束后,调用函数的对象(也就是this指针)继续拥有存储介质,释放此存储介质调用ReleaseStgMedium ()。如果fRelease==false时调用函数的对象只有在函数SetData()调用期间对存储介质有使用权(拥有权),意思是由函数堆栈自动清空释放不必调用
ReleaseStgMedium ()释放此存储介质。类似于atl的CComPtr指针:)