Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function loads an object from the stream.

Syntax

WINOLEAPI OleLoadFromStream(
  IStream* 
pStm,
  REFIID 
iidInterface,
  void** 
ppvObj
);

Parameters

pStm

[in] Pointer to the IStreaminterface on the stream from which the object is to be loaded.

iidInterface

[in] Interface identifier (IID) the caller wants to use to communicate with the object when it is loaded.

ppvObj

[out] Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, ppvObjcontains the requested interface pointer on the newly loaded object.

Return Value

The following HRESULT values can be returned.

Value Description

S_OK

The object was loaded.

E_NOINTERFACE

The specified interface is not supported.

E_OUTOFMEMORY

The function failed.

This function can also return any error value returned by the ReadClassStmand CoCreateInstancefunctions, and the IPersistStorage::Loadmethod.

Remarks

This function can be used to load an object that supports the IPersistStreaminterface.

The CLSID of the object must immediately precede the object's data in the stream, which is accomplished by the companion function OleSaveToStreamor the operations it wraps, which are described under that topic.

If the CLSID for the stream is CLSID_NULL, the ppvObjparameter is set to NULL.

To determine whether the platform supports this function, see Determining Supported COM APIs.

Requirements

Header ole2.h
Library ole32.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also