Share via


COleServerItem::OnSetData

Called by the framework to replace the OLE item's data with the specified data.

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

Parameters

  • lpFormatEtc
    Pointer to a FORMATETC structure specifying the format of the data.

  • lpStgMedium
    Pointer to a STGMEDIUM structure in which the data resides.

  • 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 server item takes ownership, freeing the medium when it has finished using it. When bRelease is 0, the caller retains ownership and the server item can use the storage medium only for the duration of the call.

Return Value

Nonzero if successful; otherwise 0.

Remarks

The server item does not take ownership of the data until it has successfully obtained it. That is, it does not take ownership if it 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 OLE item's data with the specified data. This is an advanced overridable.

For more information, see STGMEDIUM, FORMATETC, and ReleaseStgMedium in the Windows SDK.

Requirements

Header: afxole.h

See Also

Reference

COleServerItem Class

Hierarchy Chart

COleDataSource::OnSetData