读杨老师的《COM组件设计与应用》18篇 下

本文详细介绍了COM组件中的IDispatch接口,包括其核心函数Invoke的工作原理,以及在脚本调用中的作用。此外,还探讨了错误异常处理机制、事件通知的实现方式和连接点事件的差异,以及组件的持续性设计,为理解和应用COM组件提供了深入的见解。
摘要由CSDN通过智能技术生成

读杨老师《COM设计与应用》18篇 下
9 IDispatch接口
  IDispatch接口在MSDN中的定义This interface exposes objects, methods, and properties to

Automation programming tools and other applications.
  我的理解是,实际上是将一个对象的接口暴暴露给脚本或IE
  下面是IDispatch接口的四个函数
  IDispatch::GetIDsOfNames Maps a single member name and an optional set of parameter names 

 to a corresponding set of integer dispatch identifiers (DISPIDs), which can then be used  

on subsequent calls to IDispatch::Invoke. 

  IDispatch::GetTypeInfo Retrieves the type information for an object. 

  IDispatch::GetTypeInfoCount Retrieves the number of type information interfaces that an   

 object provides, either 0 or 1.
 
  IDispatch::Invoke Provides access to properties and methods exposed by an object.
  最重要的就是这个Invoke,通过设置IDipID,实现了一个接口函数调用多个功能,有点像窗口的消息
处理函数,根据不同的消息采用不同的处理方式,另外,GetIDsofNames提供将函数名转化为DispID的功

<
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值