Open topic with navigation
|Example: lrc_CoCreateInstance||Creating Instances|
Creates an instance of an object and returns the unknown interface.
HRESULTlrc_CoCreateInstance( GUID * pClsid, IUnknown * pUnkOuter, unsigned long dwClsContext, GUID * riid, LPVOID * ppv, BOOL __CheckResult );
|*pClsid||A pointer to the CLSID associated with the data and code that will be used to create the object.|
|*pUnkOuter||If NULL, indicates that the object is not being created as part of an aggregate. If non-NULL, it is a pointer to the aggregate object's IUnknown interface (the controlling IUnknown).|
|dwClsContext||Context in which the code that manages the newly created object will run. The values are taken from the enumeration CLSCTX and refer to in process, local, remote or combinations of these.|
|*riid||A pointer to the identifier of the interface to be used to communicate with the object.|
|*ppv||A pointer that receives the interface pointer requested in riid. Upon successful return, *ppv contains the requested interface pointer.|
|__CheckResult||This flag is generated by VuGen to indicate if the call was successful when the script was generated and HRESULT should be checked. Values: CHECK_HRES or DONT_CHECK_HRES.|
The lrc_CoCreateInstance function creates a single uninitialized object on either the local system or on the default host configured for the object and returns the unknown interfaces, which can be used to get other interfaces. After creating the instance, VuGen calls lrc_CoGetClassObject to retrieve the interfaces. If the COM object is on a remote machine, then lrc_CreateInstanceEx is used instead of lrc_CoCreateInstance.
This function returns HRESULT. You can use this return value in code that you write, but VuGen processes it internally and does not show it in scripts. Consult Microsoft documentation for further details.
You cannot use standard parameterization for any arguments in this function.