Share this page

# lrc_Release_Object

Creating Instances

Releases a COM object.

    int lrc_Release_Object( const char* interface );

interface | The interface by which the object is referenced, with an index. For example, IUnknown_0, IUnknown_1, etc.

The lrc_Release_Object function releases a COM object when it is no longer in use. The function releases one instance of the specified interface. After an object is released, the reference count of the object is decreased by one (e.g., `IUnknown_1` to `IUnknown_0`).

By default, this function is not automatically generated. To enable automatic generation of this function, select the Release COM Objects option in the Script tab of the Recording Options dialog box. When this option is disabled, the release calls are not generated and objects are only released at the end of the section.

## Return Values

lrc Return Values

## Parameterization

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

## Example

In the following example, the lrc_Release_Object function releases one instance of the specified interface, IUnknown_0.

    {

            GUID pClsid = lrc_GUID("FRS.Login");

            IUnknown * pUnkOuter = (IUnknown*)NULL;

            unsigned long dwClsContext = lrc_ulong("5");

            GUID riid = IID_IUnknown;

            lrc_CoCreateInstance(&pClsid, pUnkOuter, dwClsContext, &riid, (void**)&IUnknown_0, CHECK_HRES);

        }

        lrc_Release_Object((IUnknown*)IUnknown_0);

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: