Hello,
I'm trying to mimic some parts of C++ Dex2Samples example in my console application.
This function:
HRESULT CCppEikonnectDlg::CreateDex2Mgr()
{
// Create the Dex2 manager
HRESULT l_hr= g_MyEikonDesktopDataAPI->CreateDex2Mgr((IUnknown **)&g_MyDex2Mgr);
if (l_hr==S_OK)
{
g_MyDex2MgrADC = g_MyDex2Mgr;
// Initialize the Dex2 manager and retrieve a session cookie
CComVariant l_EmptyVar;
l_EmptyVar.vt=VT_ERROR;
l_EmptyVar.scode=DISP_E_PARAMNOTFOUND;
l_hr = g_MyDex2MgrADC->Initialize(Dex2Lib::DEX2_MetadataCaller::DE_MC_ADC_POWERLINK, l_EmptyVar, &g_MyDex2MgrCookie);
if (l_hr!=S_OK)
{
// Release the Dex2 manager
g_MyDex2Mgr.Release();
}
}
return l_hr;
}
throws because of the line : g_MyDex2MgrADC = g_MyDex2Mgr;. g_MyDex2MgrADC ends up as NULL.
And it happens because of QueryInterface fails inside of atlcomcli.h
However, Dex2Samples project runs fine.
What am I doing wrong?