Example: lrc_variant_CoObject_by_ref
This example assigns a pointer to an IUnknown interface in 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_CoObject_by_ref(IUnknown_0);