question

Upvotes
Accepted
5 1 1 4

Cannot instantiate AdxRtList when using COINIT_MULTITHREADED

I'm using the AdfinXRt Realtime example C++ project, and have changed the COM initialisation call in ListDlg.cpp from CoInitialize(0) to CoInitializeEx(NULL, COINIT_MULTITHREADED), to reflect how I intend to use this API in my application. However, the example no longer works because the call to a_eikonDesktopDataAPI->CreateAdxRtList() in AdxRtList.cpp now returns a null COM pointer. Is it possible to use the COM API in the COINIT_MULTITHREADED mode?

eikoneikon-com-apic++
icon clock
10 |1500

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

1 Answer

Upvotes
Accepted
39.2k 75 11 27

Hi @Tristan,

All Eikon COM APIs are implemented using STA (single-threaded apartment) model. They cannot be used in a multi-threaded apartment. To use Eikon COM APIs in your project you need to dedicate a thread, which will house all Eikon COM objects your application creates. Because Eikon COM libraries are implemented as reg free COM, these objects will only be accessible from the thread on which they were created.

icon clock
10 |1500

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

Click below to post an Idea Post Idea