OLESTATUS OleCreateFromFile(lpszProtocol, lpClient, lpszClass, lpszFile, lhClientDoc, lpszObj, lplpObject, renderopt, cfFormat) | |||||
LPCSTR lpszProtocol; | /* pointer to string for protocol name | */ | |||
LPOLECLIENT lpClient; | /* pointer to client structure | */ | |||
LPCSTR lpszClass; | /* string for class name | */ | |||
LPCSTR lpszFile; | /* string for filename | */ | |||
LHCLIENTDOC lhClientDoc; | /* long handle to client document | */ | |||
LPCSTR lpszObj; | /* string for object name | */ | |||
LPOLEOBJECT FAR* lplpObject; | /* pointer to pointer to object | */ | |||
OLEOPT_RENDER renderopt; | /* rendering options | */ | |||
OLECLIPFORMAT cfFormat; | /* clipboard format | */ |
The OleCreateFromFile function creates an embedded object from the contents of a named file.
lpszProtocol
Points to a null-terminated string specifying the name of the protocol required for the new embedded object. Currently this value can be “StdFileEditing”, the name of the object linking and embedding protocol.
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.
lpszClass
Points to a null-terminated string specifying the name of the class for the new object. If this value is NULL, the library uses the extension of the filename pointed to by the lpszFile parameter to find the class name for the object.
lpszFile
Points to a null-terminated string specifying the name of the file containing the object.
lhClientDoc
Identifies the client document in which the object is being created.
lpszObj
Points to a null-terminated string specifying the client's name for the object. This name must be unique with respect to the names of any other objects in the document.
lplpObject
Points to a variable where the library will store the long pointer to the new object.
renderopt
Specifies the client's preference for displaying and printing the object. This parameter can be one of the following values:
Value | Meaning |
olerender_none | ||
The object is not shown or an object handler does the rendering. The client library does not obtain any presentation data and does not draw the object. | ||
olerender_draw | ||
The client calls the OleDraw function and the library obtains and manages presentation data. | ||
olerender_format | ||
The client calls the OleGetData function to retrieve data in a specific format. The library obtains and manages the data in the requested format, as specified by the cfFormat parameter. |
cfFormat
Specifies the clipboard format that the client requests when it calls the OleGetData function. This parameter is used only when the renderopt parameter is olerender_format. If this clipboard format is CF_METAFILEPICT, CF_DIB, or CF_BITMAP, the library manages the data and draws the object. The library does not support drawing for any other formats.
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_CLASS
OLE_ERROR_HANDLE
OLE_ERROR_MEMORY
OLE_ERROR_NAME
OLE_ERROR_PROTOCOL
OLE_WAIT_FOR_RELEASE
When a client application calls the OleCreateFromFile function, the server is started to render the Native and presentation data and then closed. (If the server and document are already open, this function simply retrieves the information, without closing the server.) The server does not show the object to the user for editing.
OleCreate, OleCreateFromTemplate, OleDraw, OleGetData