Opens the specified file and initializes an object from the file contents.
HRESULT Load( LPCOLESTR pszFileName, DWORD dwMode );
The absolute path of the file to be opened.
The access mode to be used when opening the file. Possible values are taken from the STGM enumeration. The method can treat this value as a suggestion, adding more restrictive permissions if necessary. If dwMode is 0, the implementation should open the file using whatever default permissions are used when a user opens the file.
This method can return the following values.
||The method completed successfully.|
||The object could not be loaded due to a lack of memory.|
||The object could not be loaded for some reason other than a lack of memory.|
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 a user selects the File Open command.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. 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).
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|