gpt4 book ai didi

atl - 从外部类型库导入 IDL 中的接口(interface)

转载 作者:行者123 更新时间:2023-12-04 21:38:04 24 4
gpt4 key购买 nike

我有两个使用 ATL 和 Microsoft 的 IDL 编写的带有 COM 接口(interface)的类型库。我希望一个库中的接口(interface)从另一个库中的接口(interface)继承。

本质上,我想做与 Steven 在 How do I create interface methods using .tlb types in VS C++? 中描述的相同的事情。 .唯一回答他的人似乎不明白这个问题。

这是我想做的,在代码中:

SomeLibrary DLL/TLB

ISomeInterface.idl

interface ISomeInterface : IDispatch { ... };

SomeLibrary.idl
import "ISomeInterface.idl";

library SomeLibrary
{
interface ISomeInterface;
};

SomeOtherLibrary DLL/TLB

ISomeOtherInterface.idl
// What do I put here so that the MIDL compiler knows
// what to do when it encounters the ISomeInterface type?

interface ISomeOtherInterface : ISomeInterface { ... };

SomeOtherLibrary.idl
import "ISomeOtherInterface.idl";

library SomeOtherLibrary
{
interface ISomeOtherInterface;
};

MIDL import 指令只在导入 IDL 文件时有效,我只有一个 DLL 和 TLB。我无法使用 importlib 因为这只适用于 library 定义。 MIDL 编译器不理解微软的 C++ import , importidl , 和 importlib 属性。

该怎么办?

最佳答案

如果您愿意引入手动步骤,您可以在 oleview 中打开 tlb 并通过这种方式获取生成的 .idl 文件。 oleview.exe 位于 Windows SDK 的 bin 目录中,例如

  C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\oleview.exe

关于atl - 从外部类型库导入 IDL 中的接口(interface),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3285177/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com