question

Upvotes
Accepted
3 0 1 3

Programatically connect to Eikon and create Dex2 Manager

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?

Exception:

System.Runtime.InteropServices.COMException: 'The system cannot locate the object specified.

eikoneikon-com-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi @IS

Do I understand correctly that when following the example and creating Dex2Mgr object by clicking Create Dex2 Manager button in the user form everything works as expected? However when you modify the example and call CreateDex2Mgr method from within ConnectToEikon procedure or from within OnStatusChanged callback you get the exception? Are there any further details on the exception?

Upvote
Accepted
39.4k 77 11 27

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:
https://developers.thomsonreuters.com/eikon-com/eikon-desktop-data-api/docs?content=786

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
3 0 1 3

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.

System.Runtime.InteropServices.COMException occurred

HResult=0x80004005

Message=The system cannot locate the object specified.

Source=msxml3.dll

StackTrace:

at EikonDesktopDataAPI.IEikonDesktopDataAPI.CreateDex2Mgr()

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
3 0 1 3

Thanks Alex! That was it, I was able to watch the status and Create Dex2 after the status was Connected.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.