#include <ole.h> |
OLESTATUS OleLoadFromStream(lpStream, lpszProtocol, lpClient, lhClientDoc, lpszObjname, lplpObject) | |||||
LPOLESTREAM lpStream; | /* address of stream for object | */ | |||
LPCSTR lpszProtocol; | /* address of string for protocol name | */ | |||
LPOLECLIENT lpClient; | /* address of client structure | */ | |||
LHCLIENTDOC lhClientDoc; | /* long handle of client document | */ | |||
LPCSTR lpszObjname; | /* address of string for object name | */ | |||
LPOLEOBJECT FAR* lplpObject; | /* address of pointer to object | */ |
The OleLoadFromStream function loads an object from the containing document.
lpStream
Points to an OLESTREAM structure that was allocated and initialized by the client application. The library 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 object linking and embedding 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 library stores a pointer to the loaded object.
The return value is OLE_OK if the function is successful. Otherwise, it is an error value, which may be one of the following:
OLE_ERROR_HANDLE
OLE_ERROR_NAME
OLE_ERROR_PROTOCOL
OLE_ERROR_STREAM
OLE_WAIT_FOR_RELEASE
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 library automatically makes the link between the client and server applications when an application calls OleLoadFromStream.