|
IPersistStream::Load
Initializes an object from the stream where it was previously saved.
HRESULT Load(
IStream *pStm
| //Pointer to the stream from which the object should be loaded
| );
|
|
Parameter
pStm
[in]Points to the stream from which the object should be loaded.
Return Values
S_OK
The object was successfully loaded.
E_OUTOFMEMORY
The object was not loaded due to a lack of memory.
E_FAIL
The object was not loaded due to some reason other than a lack of memory.
Comments
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 must be in the same position it was in on entry,
immediately past the end of the data.
Notes to Callers
Rather than calling IPersistStream::Load directly, you typically use the OleLoadFromStream function which performs the following steps:
- 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 is the storage pattern 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.
See Also
CoCreateInstance, OleLoadFromStream, ReadClassStm
Related LinksSoftware for Delphi and C++ Builder developers Software for Visual Studio .NET developers Software for Visual Basic 6 developers Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps Win32 Programmer's Reference (win32.hlp) Win32 Multimedia Programmer's Reference (mmedia.hlp) Microsoft Windows Pen API Programmer's Reference (penapi.hlp) Microsoft Windows Sockets 2 Reference (sock2.hlp) Microsoft Windows Telephony API (TAPI) Programmer's Reference (sock2.hlp) Unix Manual Pages
|