OleLoadFromStream

  OLESTATUS OleLoadFromStream(lpStream, lpszProtocol, lpClient, lhClientDoc, lpszObjname, lplpObject)    
  LPOLESTREAM lpStream; /* pointer to stream for object */
  LPCSTR lpszProtocol; /* pointer to string for protocol name */
  LPOLECLIENT lpClient; /* pointer to client structure */
  LHCLIENTDOC lhClientDoc; /* long handle to client document */
  LPCSTR lpszObjname; /* string for object name */
  LPOLEOBJECT FAR* lplpObject; /* pointer to pointer to object */

The OleLoadFromStream function loads an object from the containing document.

Parameters

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. Attempts to open static objects fail and generate no notifications.

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.

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value, which can be one of the following:

OLE_ERROR_HANDLE
OLE_ERROR_NAME
OLE_ERROR_PROTOCOL
OLE_ERROR_STREAM
OLE_WAIT_FOR_RELEASE

Comments

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

See Also

OleSaveToStream, OleQuerySize