A version of this page is also available for
This method initializes an object from the stream where it was previously saved.
HRESULT Load( IStream* pStm );
[in] IStream pointer to the stream from which the object should be loaded.
The following table shows the return values for this method.
The object was successfully loaded.
The object was not loaded due to a lack of memory.
The object was not loaded due to some reason other than a lack of memory.
This method loads an object from its associated stream. The seek pointer is set as it was in the most recent IPersistStream::Save method. This method can seek and read from the stream, but cannot write to it.
On exit, the seek pointer should be left in the same position as it was on exit from Save, immediately past the end of the data.
To determine whether the platform supports this interface, see Determining Supported COM APIs.
Notes to Callers
Rather than calling IPersistStream::Load directly, you typically call the OleLoadFromStream function does the following:
- Calls the ReadClassStm function to get the class identifier from the stream.
- Calls the CoCreateInstance function to create an instance of the object.
- Queries the instance for IPersistStream.
- Calls IPersistStream::Load.
The OleLoadFromStream function assumes that objects are stored in the stream with a class identifier followed by the object data. This storage pattern is used by the generic, composite-moniker implementation provided by OLE.
If the objects are not stored using this pattern, you must call the methods separately yourself.
|Windows Embedded CE||Windows CE 3.0 and later|
|Windows Mobile||Windows Mobile Version 5.0 and later|