Opens the specified file and initializes an object from the file contents.
HRESULT Load(
LPCOLESTR pszFileName,
//Pointer to absolute path of the file to open
DWORD dwMode //Specifies the access mode from the STGM enumeration
);
IPersistFile::Load loads the object from the specified file. This method is for initialization only and does not show the object to the end user. It is not equivalent to what occurs when an end user selects the File Open command.
The BindToObject method in file monikers calls this method to load an object during a moniker binding operation (when a linked object is run). Typically, applications do not call this method directly.
Because the information needed to open a file varies greatly from one application to another, the object on which this method is implemented must also open the file specified by the pszFileName parameter. This differs from the IPersistStorage::Load and IPersistStream::Load, in which the caller opens the storage or stream and then passes an open storage or stream pointer to the loaded object.
For an application that normally uses OLE compound files, your IPersistFile::Load implementation can simply call the StgOpenStorage function to open the storage object in the specified file. Then, you can proceed with normal initialization. Applications that do not use storage objects can perform normal file-opening procedures.
When the object has been loaded, your implementation should register the object in the Running Object Table (see IRunningObjectTable::Register).
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in objidl.h.
IRunningObjectTable::Register, StgOpenStorage