Example: lrc_DispObject_by_ref_from_variant
This example extracts the IDispatch interface IDispatch_0 from the variant reference var.
//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); } //Extract IDispatch Interface VARIANT var = lrc_variant_DispObject_by_ref((IDispatch*)IDispatch_0); IDispatch_0= (IDispatch*)lrc_DispObject_by_ref_from_variant(var);