Share this page

# lrc_CreateInstanceEx

Creating Instances

Creates an instance of an object on a remote machine and can return multiple interfaces.

    HRESULT lrc_CreateInstanceEx( char *clsidStr, Iunknown *pUnk, DWORD dwClsCtx, ...);

*clsidStr | A pointer to the CLSID string of the object to be created.
*pUnk | When non-NULL, indicates the instance is being created as part of an aggregate, and punkOuter is to be used as the new instance's controlling IUnknown. Aggregation is currently not supported cross-process or cross-machine. When instantiating an object out of process, CLASS_E_NOAGGREGATION will be returned if pUnk is non-NULL.
dwClsCtx | 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.

Additional Arguments

*pServerInfo Args | Pointer to arguments in place of pServerInfo. In the original Microsoft definition, pServerInfo is a structure giving Information about the computer on which to instantiate the object. VuGen breaks up the structure into a series of parameters separated by keywords: IDENTITY, INFO and REMOTEMACHINE. If these arguments are omitted, the object is instantiated on the local computer or at the computer specified in the registry under the class's RemoveServerName named value, according to the interpretation of the dwClsCtx parameter.
*pResults Args | Pointer to arguments in place of pResults. In the original Microsoft definition, pResults is a structure with a list of interfaces. VuGen breaks up the structure into a series of parameter triplets. Each triplet contains the identifier for a requested interface (pIID), the location to return the interface pointer(pItf) and flag for checking errors as in __CheckResult). If the call returns an interface for the GUID, then VuGen will write the name of that interface when it generates the script. However, if the GUID is unrecognized on the remote machine, then VuGen will write "dummy" when it generates the script.

__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_CreateInstanceEx function creates an uninitialized object on a designated remote machine, and can return any number of requested interfaces.

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.

## Return Values

lrc Return Values

## Parameterization

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

## Example

In the following example, lrc_CreateInstanceEX creates an uninitialized object on a designated remote machine.

Copy code

            IUnknown *dummy_0 = 0;
            lrc_CreateInstanceEx("student.student.1",(IUnknown*)0, 21,
                   IDENTITY, "zemel", "ABC", "password",
                   INFO, 7, 6, "0016D794", 9,
                   REMOTEMACHINE, "ZEMEL_PC",
                   INTERFACE_BEGIN,
                   "{00000000-0000-0000-C000-000000000046}",(IUnknown**)&IUnknown_0, CHECK_HRES,
                   "{5B6AEBB0-CD1C-11D1-8E17-0060085DA92F}",(IUnknown**)&Istudent_0, CHECK_HRES,
                   "{00000000-0000-0000-0000-000000000000}",(IUnknown**)&dummy_0, DONT_CHECK_HRES,
                   INTERFACE_END,
                   CHECK_HRES);

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