Share this page

# lrc_CoGetClassObject

Example:lrc_CoGetClassObject | Creating Instances

Fetches the class factory for the specified class. The class factory can then be used to create multiple objects of that class.

    void lrc_CoGetClassObject( REFCLSID rclsid, Long dwClsContext, COSERVERINFO * pServerInfo, REFIID riid, LPVOID * ppv );

rclsid | CLSID associated with the data and code that you will use to create the objects.
dwClsContext | Context in which the executable code is to be run. To enable a remote activation, CLSCTX_REMOTE_SERVER must be included.
*pServerInfo | Pointer to machine on which to instantiate the class object. May be NULL, in which case the class object is instantiated on the current machine or at the machine specified under the class's RemoteServerName key in the registry, according to the interpretation of the dwClsCtx parameter (see the CLSCTX documentation for details).
*riid | Pointer to the identifier of the interface, which will be supplied in ppv on successful return. This interface will be used to communicate with the class object. Typically this value is IID_IClassFactory, although other values – such as IID_IClassFactory2 which supports a form of licensing – are allowed. All OLE-defined interface IIDs are defined in the OLE header files as IID_interfacename, where interfacename is the name of the interface.
*ppv | Address of pointer variable 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_CoGetClassObject function fetches the class factory for the specified class.

The class factory can then be used to create multiple objects of that class. Consult Microsoft documentation for further details.

## Return Values

lrc Return Values

## Parameterization

You cannot use standard parameterization for any arguments in this function.

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: