Accessing Eikon v4 style fields using DEX2 C++ COM API

I'm trying to access fields TR.CommonName and TR.InstrumentType for VOD.L using the DEX2 C++ example project, but I'm getting an error "The access to field(s) denied". It seems like this is because the example project is not set up to work with Eikon v4-style fields, but I can't figure out how to configure it so that it does. Does anyone have a working C++ example that I can take a look at?

Best Answer

Answers

  • @Tristan

    The code should look like this:

    1. Declare Dex2Lib::IDex2Mgr2

    ...
    CComPtr<Dex2Lib::IDex2Mgr> g_MyDex2Mgr;
    CComPtr<Dex2Lib::IDex2Mgr2> g_MyDex2Mgr2;
    ...

    2. Initialize g_MyDex2Mgr2 instead of g_MyDex2Mgr

    HRESULT l_hr= g_MyEikonDesktopDataAPI->CreateDex2Mgr((IUnknown **)&g_MyDex2Mgr);

    g_MyDex2Mgr2 = g_MyDex2Mgr;
    ...
    l_hr = g_MyDex2Mgr2->Initialize(Dex2Lib::DEX2_MetadataCaller::DE_MC_ADC_POWERLINK, l_EmptyVar, &g_MyDex2MgrCookie);

    3. Release g_MyDex2Mgr2 instead of g_MyDex2Mgr

    g_MyDex2Mgr2.Release();

    Please see the attached file (cppeikonnectdlg.zip).