IPersistStorage::Load method (objidl.h)
Loads an object from its existing storage.
HRESULT Load( [in] IStorage *pStg );
An IStorage pointer to the existing storage from which the object is to be loaded.
This method can return the following values.
||The method completed successfully.|
||The object has already been initialized by a previous call to the IPersistStorage::Load method or the IPersistStorage::InitNew method.|
||The object was not loaded due to lack of memory.|
||The object was not loaded due to some reason other than a lack of memory.|
This method initializes an object from an existing storage. The object is placed in the loaded state if this method is called by the container application. If called by the default handler, this method places the object in the running state.
Either the default handler or the object itself can hold onto the IStorage pointer while the object is loaded or running.OleLoad helper function which does the following:
- Create an uninitialized instance of the object class.
- Query the new instance for the IPersistStorage interface.
- Call Load to initialize the object from the existing storage.
The container should cache the IPersistStorage pointer for use in later operations on the object.
- Open the object's streams in the storage object, and read the necessary data into the object's internal data structures.
- Clear the object's dirty flag.
- Call the AddRef method and cache the passed in storage pointer.
- Keep open and cache the pointers to any streams or storages that the object will need to save itself to this storage.
- Perform any other default initialization required for the object.
Your implementation of this method should return the CO_E_ALREADYINITIALIZED error code if it receives a call to either the IPersistStorage::InitNew method or the IPersistStorage::Load method after it is already initialized.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|