请问怎么实现IDispatch接口的多重继承
请教如何实现IDispatch接口的多重继承?
就拿MSHTML来说吧,比如说有以下两个接口:
IHTMLElement = interface(IDispatch)
IHTMLImgElement = interface(IDispatch)
THtmlImgElement = class(TAutoIntfObject, IHtmlElement, IHtmlImgElement)
// ...
constructor Create(...);
end;
constructor THtmlImgElement.Create(...);
begin
inherited Create(ComServer.TypeLib, IHTMLImgElement);
// 实现的时候只能注册一个接口
end;
这样的话,脚本语言调用的时候只能使用IHtmlImgElement接口而无法转换到IHtmlElement,因为脚本语言不能QueryInterface。
请大家点拨一下,谢谢!
------解决方案--------------------
怎么会
HTML元素都支持双接口。脚本语言用的是IDispatch接口
------解决方案--------------------
脚本语言调用自动化对象何需转换?
就拿MSHTML来说吧,比如说有以下两个接口:
IHTMLElement = interface(IDispatch)
IHTMLImgElement = interface(IDispatch)
THtmlImgElement = class(TAutoIntfObject, IHtmlElement, IHtmlImgElement)
// ...
constructor Create(...);
end;
constructor THtmlImgElement.Create(...);
begin
inherited Create(ComServer.TypeLib, IHTMLImgElement);
// 实现的时候只能注册一个接口
end;
这样的话,脚本语言调用的时候只能使用IHtmlImgElement接口而无法转换到IHtmlElement,因为脚本语言不能QueryInterface。
请大家点拨一下,谢谢!
------解决方案--------------------
怎么会
HTML元素都支持双接口。脚本语言用的是IDispatch接口
------解决方案--------------------
脚本语言调用自动化对象何需转换?