M. *_*ley 5 idl atl typelib midl
我有两个带有 COM 接口的类型库,它们是我使用 ATL 和 Microsoft 的 IDL 编写的。我希望一个库中的接口继承另一个库中的接口。
本质上,我想做史蒂文在如何在 VS C++ 中使用 .tlb 类型创建接口方法? 中描述的同样的事情。。唯一回答他的人似乎并不明白这个问题。
这是我想做的,用代码:
interface ISomeInterface : IDispatch { ... };
Run Code Online (Sandbox Code Playgroud)
import "ISomeInterface.idl";
library SomeLibrary
{
interface ISomeInterface;
};
Run Code Online (Sandbox Code Playgroud)
// What do I put here so that the MIDL compiler knows
// what to do when it encounters the ISomeInterface type?
interface ISomeOtherInterface : ISomeInterface { ... };
Run Code Online (Sandbox Code Playgroud)
import "ISomeOtherInterface.idl";
library SomeOtherLibrary
{
interface ISomeOtherInterface;
};
Run Code Online (Sandbox Code Playgroud)
MIDLimport指令仅在导入IDL文件时有效,而且我只有DLL和TLB。我不能使用,importlib因为它只在library定义内有效。MIDL 编译器不理解 Microsoft 的 C++ import、importidl和importlib属性。
该怎么办?
如果您愿意引入手动步骤,您可以在 oleview 中打开 tlb 并以这种方式获取生成的 .idl 文件。oleview.exe 位于 Windows SDK 的 bin 目录中,例如
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\oleview.exe
Run Code Online (Sandbox Code Playgroud)