首页 > 其他 > 详细

CVI 调用ACtiveX控件出现错误

时间:2020-02-23 11:07:35      阅读:82      评论:0      收藏:0      [点我收藏+]

利用CVI 做工程,三级窗体包含日期activeX控件,在win10下运行报如下错误。

后在main.c 中加上这个

 if (InitCVIRTE (0, argv, 0) == 0)
  return -1;
 
 CA_InitActiveXThreadStyleForCurrentThread (0,  COINIT_APARTMENTTHREADED );

这样解决问题。

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

CVI 调用ACtiveX控件出现错误

原文:https://www.cnblogs.com/xihong2014/p/12348572.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!