Creates an embedded object from the contents of a named file.
WINOLEAPI OleCreateFromFile(
REFCLSID rclsid, //Reserved. Must be CLSID_NULL
LPCOLESTR lpszFileName, //Pointer to full path of file used to
// create object
REFIID riid, //Reference to the identifier of the
// interface to be used to communicate with
// new object
DWORD renderopt, //Value from OLERENDER
LPFORMATETC pFormatEtc, //Pointer to the FORMATETC structure
LPOLECLIENTSITE pClientSite,
//Pointer to an interface
LPSTORAGE pStg, //Pointer tothe interface to be used as
// object storage
LPVOID FAR* ppvObj //Address of output variable that
// receives the interface pointer requested
// in riid
);
This function supports the standard return value E_OUTOFMEMORY, as well as the following:
The OleCreateFromFile function creates a new embedded object from the contents of a named file. If the ProgID in the registration database contains the PackageOnFileDrop key, it creates a package. If not, the function calls the GetClassFile function to get the CLSID associated with the lpszFileName parameter, and then creates an OLE 2-embedded object associated with that CLSID. The rclsid parameter of OleCreateFromFile will always be ignored, and should be set to CLSID_NULL.
As for other OleCreateXxx functions, the newly created object is not shown to the user for editing, which requires a DoVerb operation. It is used to implement insert file operations, such as the Create from File command in Word for Windows.
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in ole2.h.
Import Library: Included as a resource in ole32.dll.