COM中的IDispatch和IUnkown有什么区别? [英] What is the difference between IDispatch and IUnkown in COM?

查看:146
本文介绍了COM中的IDispatch和IUnkown有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读并看到了 COM 的示例,但是我不能清楚地看到 Interface 之间的区别。

I have read and saw example for COM, but I couldn't clearly get there Interface difference.

推荐答案

IUnknown 是主要的COM接口。它提供了将COM对象的实例投射到其任何受支持的接口(QueryInterface)的基本能力。

IUnknown is the primal COM interface. It provides the basic ability to "cast" a instance of a COM object to any of it's supported interfaces (QueryInterface).

IDispatch IUnknown添加了在运行时发现指定COM对象支持的属性和接口的工具。这允许后期绑定和动态绑定。各种补救措施。借助IDispatch,应用程序可以发现组件的功能并调用发现的方法(简称为自动化)。

IDispatch builds on IUnknown adding the facility to discover at run-time the attributes and interfaces supported by the specified COM object. This allows for late-binding and dynamic-binding. A remedial reflection of sorts. With IDispatch, an application can discover the capability of components and invoke discovered methods (which was simplistically called automation).

请参见在MSDN上实现IDispatch接口[自动化] (从WayBack Machine复活-当前在线版本)。

See Implementing the IDispatch Interface [Automation] on MSDN (resurrected from WayBack Machine - current online version).

这篇关于COM中的IDispatch和IUnkown有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆