Share this page

# lrc_variant_DispObject

Assignment to Variants

Assigns an IDispatch interface pointer to a variant.

    VARIANT lrc_variant_DispObject( IDispatch* pDispatch );

    VARIANT lrc_variant_DispObject_by_variant( IDispatch* pDispatch );

pUnknown | A pointer to an IDispatch interface.

The lrc_variant_DispObject function assigns an IDispatch interface pointer to a variant.

The lrc_variant_DispObject_by_variant function assigns an IDispatch interface pointer to a variant and returns a variant containing a reference to the variant containing the IDispatch reference.

## Return Values

lrc Return Values

## Parameterization

Parameterization is not applicable to this function.

## Example

This example assigns an IDispatch interface pointer to a variant.

    //Build variant

    IUnknown * IUnknown_0 = 0;

    IDispatch * IDispatch_0 = 0;

    {

        GUID pClsid = lrc_GUID("ADODB.Recordset.2.1");

        IUnknown * pUnkOuter = (IUnknown*)NULL;

        unsigned long dwClsContext = lrc_ulong("7");

        GUID riid = IID_IUnknown;

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

    }

    {

        GUID riid = IID_IDispatch;

        lrc_IUnknown_QueryInterface(IUnknown_0, &riid, (void**)&IDispatch_0, CHECK_HRES);

      }

    //Assign pointer to variant

    VARIANT var = lrc_variant_DispObject(IDispatch_0);

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