9.4.11 OleLoadFromStream

OLESTATUS OleLoadFromStream(lpStream, lpszProtocol, lpClient, lhClientDoc,

lpszObjname, lplpObject)

LPOLESTREAM lpStream;

LPCSTR lpszProtocol;

LPOLECLIENT lpClient;

LHCLIENTDOC lhClientDoc;

LPCSTR lpszObjname;

LPOLEOBJECT FAR * lplpObject;

The OleLoadFromStream function loads an object from the containing document.

Parameter Description

lpStream Points to an OLESTREAM structure that was allocated and initialized by the client application. The client DLL calls the Get function in the OLESTREAMVTBL structure to obtain the data for the object.
lpszProtocol Points to a null-terminated string specifying the name of the required protocol. Currently this value can be "StdFileEditing" (the name of the OLE protocol) or "Static" (for uneditable pictures only).
lpClient Points to an OLECLIENT structure allocated and initialized by the client application. This pointer is used to locate the callback function and is passed in callback notifications.
lhClientDoc Identifies the client document in which the object is being created.
lpszObjname Points to a null-terminated string specifying the client's name for the object.
lplpObject Points to a variable in which the client DLL stores a pointer to the loaded object.

To load an object, the client application needs only the location of that object in a file. A client typically loads an object only when the object is needed (for example, when it must be displayed).

If an object cannot be loaded when the lpszProtocol parameter specifies "StdFileEditing," the application can call the OleLoadFromStream function again, specifying "Static."

If the object is linked and the server and document are open, the DLL automatically makes the link between the client and server applications when an application calls OleLoadFromStream.

The return value is OLE_OK if successful; otherwise, it could be one of the following:

OLE_ERROR_HANDLE

OLE_ERROR_NAME

OLE_ERROR_PROTOCOL

OLE_ERROR_STATIC_FROM_OTHER_OS

OLE_ERROR_STREAM

OLE_WAIT_FOR_RELEASE

See AlsoOleSaveToStream, OleQuerySize