IPersistStream::Load method
Initializes an object from the stream where it was saved previously.
Syntax
HRESULT Load(
[in] IStream *pStm
);
Parameters
- pStm [in]
-
An IStream pointer to the stream from which the object should be loaded.
Return value
This method can return the following values.
| Return code | Description |
|---|---|
|
The method completed successfully. |
|
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. |
Remarks
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.
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.
URL Moniker Notes
Initializes an URL moniker from data within a stream, usually stored there previously using its IPersistStream::Save (using OleSaveToStream). The binary format of the URL moniker is its URL string in Unicode (may be a full or partial URL string, see CreateURLMonikerEx for details). This is represented as a ULONG count of characters followed by that many Unicode characters.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
IDL |
|
|
IID |
IID_IPersistStream is defined as 00000109-0000-0000-C000-000000000046 |
See also