共用方式為


COleServerItem::OnInitFromData

Called by the framework to initialize an OLE item using the contents of pDataObject.

virtual BOOL OnInitFromData(
   COleDataObject* pDataObject,
   BOOL bCreation 
);

Parameters

  • pDataObject
    Pointer to an OLE data object containing data in various formats for initializing the OLE item.

  • bCreation
    TRUE if the function is called to initialize an OLE item being newly created by a container application. FALSE if the function is called to replace the contents of an already existing OLE item.

Return Value

Nonzero if successful; otherwise 0.

Remarks

If bCreation is TRUE, this function is called if a container implements Insert New Object based on the current selection. The data selected is used when creating the new OLE item. For example, when selecting a range of cells in a spreadsheet program and then using the Insert New Object to create a chart based on the values in the selected range. The default implementation does nothing. Override this function to choose an acceptable format from those offered by pDataObject and initialize the OLE item based on the data provided. This is an advanced overridable.

For more information, see IOleObject::InitFromData in the Windows SDK.

Requirements

Header: afxole.h

See Also

Reference

COleServerItem Class

Hierarchy Chart

Other Resources

COleServerItem Members