Q:ActiveX controls cannot be created in a thread whose concurrency model is multithread apartment (MTA)
A:The fix to this issue is to call CA_InitActiveXThreadStyleForCurrentThread prior to calling NiScope_Init. The explanation of this is that the ActiveX controls need to run with the apartment-threading-model (STA). When the CVI run-time encounters an ActiveX control it will initialize the thread to STA. What is happening is that NiScope_Init is probably initializing this to a multi-thread-apartment(MTA) first, so it is running into a conflict when the CVI run-time tries to run it on STA since its already initialized on MTA
本文介绍了解决ActiveX控件在多线程公寓(MTA)中创建失败的问题。通过在调用NiScope_Init前使用CA_InitActiveXThreadStyleForCurrentThread将线程初始化为单线程公寓(STA),可以避免MTA与STA之间的冲突。

6306

被折叠的 条评论
为什么被折叠?



