Dela via


COleClientItem::CreateFromFile

Call this function to create an embedded OLE item from a file.

BOOL CreateFromFile(
   LPCTSTR lpszFileName,
   REFCLSID clsid = CLSID_NULL,
   OLERENDER render = OLERENDER_DRAW,
   CLIPFORMAT cfFormat = 0,
   LPFORMATETC lpFormatEtc = NULL 
);

Parameters

  • lpszFileName
    Pointer to the name of the file from which the OLE item is to be created.

  • clsid
    Reserved for future use.

  • render
    Flag specifying how the server will render the OLE item. For the possible values, see OLERENDER in the Windows SDK.

  • cfFormat
    Specifies the Clipboard data format to be cached when creating the OLE item.

  • lpFormatEtc
    Pointer to a FORMATETC structure used if render is OLERENDER_FORMAT or OLERENDER_DRAW. Provide a value for this parameter only if you want to specify additional format information beyond the Clipboard format specified by cfFormat. If you omit this parameter, default values are used for the other fields in the FORMATETC structure.

Return Value

Nonzero if successful; otherwise 0.

Remarks

The framework calls this function from COleInsertDialog::CreateItem if the user chooses OK from the Insert Object dialog box when the Create from File button is selected.

For more information, see OleCreateFromFile, OLERENDER, and FORMATETC in the Windows SDK.

Requirements

Header: afxole.h

See Also

Reference

COleClientItem Class

Hierarchy Chart

COleInsertDialog::CreateItem

Other Resources

COleClientItem Members