ATL Com 如何用线程产生异步事件

本文详细介绍了如何在MFC应用程序中利用ATL COM组件创建线程,以及如何在线程中触发异步事件,以实现高效、响应迅速的Windows应用交互。
摘要由CSDN通过智能技术生成

 


 
windowless的ActiveX, 请特别注意最后一段。
 

 
 
SAMPLE:   Firing   Events   From   a   Second   Thread  
   
  ---------------------------------------------------------------------  
  The   information   in   this   article   applies   to:  
   
    -   Microsoft   Visual   C++,   32-bit   Edition   versions   4.0,   4.1,   4.2  
  ---------------------------------------------------------------------  
   
  SUMMARY  
  =======  
   
  MFC   based   ActiveX   controls   typically   fire   their   events   from   the   same   thread  
  that   implements   the   sink   interface   of   the   container   that   the   events   are    
  being   fired   to.  
   
  Sometimes,   it   is   desirable   to   start   a   second   thread   in   an   ActiveX   control  
  which   will   fire   events   to   the   container.   Since   MFC   ActiveX   controls  
  use   the   Apartment   threading   model,   special   consideration   must   be   taken  
  into   account   when   firing   events   from   a   secondary   thread.  
   
  MORE   INFORMATION  
  ================  
   
  An   MFC   based   ActiveX   control   supports   events   by   implementing   the  
  IConnectionPointContainer   and   IConnectionPoint   interfaces,   as   well   as  
  supplying   information   about   it's   event   interface   in   it's   type   information.  
  When   an   MFC   based   ActiveX   control   is   embedded   in   a   container   that   supports  
  events,   that   container   will   dynamically   construct   a   sink   interface   that   has  
  all   of   the   methods   specified   in   the   control's   type   information   for   it's  
  event   interface.   Once   the   container   constructs   it&#
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值