Share this page

# lrc_variant_DispObject_by_ref

Assignment to Variants - By Reference and By Variant

Assigns a pointer to an IDispatch interface in a variant.

    VARIANT lrc_variant_DispObject_by_ref( IDispatch* pDispatch );

pUnknown | A pointer to an IDispatch interface.

The lrc_variant_DispObject_by_ref function converts a pointer to an IDispatch interface in a variant.

## Return Values

lrc Return Values

## Parameterization

Parameterization is not applicable to this function.

## Example

This example assigns a pointer to an IDispatch interface in a variant.

Copy code

    //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_by_ref(IDispatch_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: