Skip to content

Latest commit

 

History

History
180 lines (109 loc) · 6.65 KB

nf-ole-olecreate.md

File metadata and controls

180 lines (109 loc) · 6.65 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:ole.OleCreate
OleCreate function (ole.h)
The OleCreate function (ole.h) creates an embedded object identified by a CLSID. It can implement the menu item that allows the insertion of a new object.
OleCreate
OleCreate function [COM]
_ole_OleCreate
com.olecreate
ole/OleCreate
com\olecreate.htm
com
00b7edd2-8e2e-4e0a-91a6-d966f6c8d456
08/15/2022
OleCreate, OleCreate function [COM], _ole_OleCreate, com.olecreate, ole/OleCreate
ole.h
Ole2.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
Ole32.lib
Ole32.dll
Windows
19H1
OleCreate
ole/OleCreate
c++
APIRef
kbSyntax
DllExport
Ole32.dll
OleCreate

OleCreate function

-description

Creates an embedded object identified by a CLSID. You use it typically to implement the menu item that allows the end user to insert a new object.

-parameters

-param unnamedParam1

TBD

-param unnamedParam2

TBD

-param unnamedParam3

TBD

-param unnamedParam4

TBD

-param unnamedParam5

TBD

-param unnamedParam6

TBD

-param unnamedParam7

TBD

-param unnamedParam8

TBD

- pClientSite [in]

If you want OleCreate to call IOleObject::SetClientSite, pointer to the IOleClientSite interface on the container. The value may be NULL, in which case you must specifically call IOleObject::SetClientSite before attempting operations.

- pFormatEtc [in]

Depending on which of the OLERENDER flags is used as the value of renderopt, pointer to one of the FORMATETC enumeration values. Refer to the OLERENDER enumeration for restrictions. This parameter, along with the renderopt parameter, specifies what the new object can cache initially.

- pStg [in]

Pointer to an instance of the IStorage interface on the storage object. This parameter may not be NULL.

- ppvObj [out]

Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, *ppvObject contains the requested interface pointer.

- rclsid [in]

CLSID of the embedded object that is to be created.

- renderopt [in]

A value from the enumeration OLERENDER, indicating the locally cached drawing capabilities the newly created object is to have. The OLERENDER value chosen affects the possible values for the pFormatEtc parameter.

- riid [in]

Reference to the identifier of the interface, usually IID_IOleObject (defined in the OLE headers as the interface identifier for IOleObject), through which the caller will communicate with the new object.

-returns

This function returns S_OK on success and supports the standard return value E_OUTOFMEMORY.

Return code Description
E_OUTOFMEMORY
Insufficient memory for the operation.

-remarks

The OleCreate function creates a new embedded object, and is typically called to implement the menu item Insert New Object. When OleCreate returns, the object it has created is blank (contains no data), unless renderopt is OLERENDER_DRAW or OLERENDER_FORMAT, and is loaded. Containers typically then call the OleRun function or IOleObject::DoVerb to show the object for initial editing.

The rclsid parameter specifies the CLSID of the requested object. CLSIDs of registered objects are stored in the system registry. When an application user selects Insert Object, a selection box allows the user to select the type of object desired from those in the registry. When OleCreate is used to implement the Insert Object menu item, the CLSID associated with the selected item is assigned to the rclsid parameter of OleCreate.

The riid parameter specifies the interface the client will use to communicate with the new object. Upon successful return, the ppvObject parameter holds a pointer to the requested interface.

The created object's cache contains information that allows a presentation of a contained object when the container is opened. Information about what should be cached is passed in the renderopt and pFormatetc values. When OleCreate returns, the created object's cache is not necessarily filled. Instead, the cache is filled the first time the object enters the running state. The caller can add additional cache control with a call to IOleCache::Cache after the return of OleCreate and before the object is run. If renderopt is OLERENDER_DRAW or OLERENDER_FORMAT, OleCreate requires that the object support the IOleCache interface. There is no such requirement for any other value of renderopt.

If pClientSite is non-NULL, OleCreate calls IOleObject::SetClientSite through the pClientSite pointer. IOleClientSite is the primary interface by which an object requests services from its container. If pClientSite is NULL, you must make a specific call to IOleObject::SetClientSite before attempting any operations.

-see-also

FORMATETC

IOleClientSite

IOleObject

OLERENDER