I'm using the example code CSharpEikonnect and trying to create Dex2 Manager by calling CreateDex2Mgr() immediately after ConnectToEikon() completes. I also tried to call CreateDex2Mgr() from the OnStatusChanged method after the connection to Eikon is successful but in both cases I get the exception below. Is it possible to programatically connect to Eikon and create Dex2 manager?
System.Runtime.InteropServices.COMException: 'The system cannot locate the object specified.
More than likely you're calling CreateDex2Mgr function before your application connected to Eikon. When MyEikonDesktopDataAPI.Initialize returns EEikonDataAPIInitializeResult.Succeed, it does not mean the application is already connected to Eikon. It just means the Initialize method was called successfully. OnStatusChanged event being triggered also does not necessarily mean the application is connected to Eikon. Inside OnStatusChanged event handler you need to check the value of EStatus parameter. Outside of this event handler you can check the value of MyEikonDesktopDataAPI.Status property. CreateDex2Mgr function will only execute successfully if either EStatus or MyEikonDesktopDataAPI.Status value is EEikonStatus.Connected. In the example UpdateUserFormAccordingToConnectionStatus procedure enables "Create Dex2 Manager" button only once the value of EStatus parameter passed to OnStatusChanged event handler is EEikonStatus.Connected.
For full documentation on EikonDesktopDataAPI library refer to the Developer Reference Guide under the Documentation tab:
That is correct Alex. I tried creating Dex2Mgr object in several different ways including from the ConnectToEikon and OnStatusChanged methods. I got the same error in each case. For example the error details below occurred when I called CreateDex2Mgr() from Form1 immediately after connecting to Eikon.
Message=The system cannot locate the object specified.
at CSharpEikonnect.Form1.CreateDex2Mgr() in C:…\CSharp\Form1.cs:line 90
at CSharpEikonnect.Form1..ctor() in C:\...Form1.cs:line 29
at CSharpEikonnect.Program.Main() in C:\...\Program.cs:line 18