Condividi tramite


COleDataSource::OnSetData

Called by the framework to set or replace the data in the COleDataSource object in the specified format.

virtual BOOL OnSetData(
   LPFORMATETC lpFormatEtc,
   LPSTGMEDIUM lpStgMedium,
   BOOL bRelease 
);

Parameters

  • lpFormatEtc
    Points to the FORMATETC structure specifying the format in which data is being replaced.

  • lpStgMedium
    Points to the STGMEDIUM structure containing the data that will replace the current contents of the COleDataSource object.

  • bRelease
    Indicates who has ownership of the storage medium after completing the function call. The caller decides who is responsible for releasing the resources allocated on behalf of the storage medium. The caller does this by setting bRelease. If bRelease is nonzero, the data source takes ownership, freeing the medium when it has finished using it. When bRelease is 0, the caller retains ownership and the data source can use the storage medium only for the duration of the call.

Return Value

Nonzero if successful; otherwise 0.

Remarks

The data source does not take ownership of the data until it has successfully obtained it. That is, it does not take ownership if OnSetData returns 0. If the data source takes ownership, it frees the storage medium by calling the ReleaseStgMedium function.

The default implementation does nothing. Override this function to replace the data in the specified format. This is an advanced overridable.

For more information, see the STGMEDIUM and FORMATETC structures and the ReleaseStgMedium and IDataObject::GetData functions in the Windows SDK*.*

Requirements

Header: afxole.h

See Also

Reference

COleDataSource Class

Hierarchy Chart

COleDataSource::DelaySetData

COleDataSource::OnRenderData

COleDataSource::OnRenderFileData

COleDataSource::OnRenderGlobalData

COleServerItem::OnSetData

Other Resources

COleDataSource Members