首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何修复MIDL生成的Typelib?

如何修复MIDL生成的Typelib?
EN

Stack Overflow用户
提问于 2014-04-06 17:26:36
回答 1查看 316关注 0票数 0

我正在尝试使用IDL 在这一页生成INetCfg接口的类型,如下所示:

代码语言:javascript
复制
import "netcfgx.idl";

[
        uuid(d99085ff-c5d7-4a4c-a987-91a513e268a9),
        version(1.0),
        helpstring("NetCfgX 1.0 Type Library")
]
library NetCFGLib
{
        interface IEnumNetCfgBindingInterface;
        interface IEnumNetCfgBindingPath;
        interface IEnumNetCfgComponent;
        interface INetCfg;
        interface INetCfgProperties;
        interface INetCfgLock;
        interface INetCfgBindingInterface;
        interface INetCfgBindingPath;
        interface INetCfgComponentBindings;
        interface INetCfgBindingPath;
        interface INetCfgClass;
        interface INetCfgComponent;
        interface INetCfgIdentification;
        interface INetCfgClassSetup;
};

不幸的是,生成的IDL仍然不能从comtype加载,下面给出了代码:

代码语言:javascript
复制
        import comtypes.client as cc
        cc.GetModule("C:\path\to\netcfg.tlb")

它给出了这个错误WindowsError: [Error -2147312566] Error loading type library/DLL

如何修复此错误?我使用的是Windows 7 64位和Python 27 64

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-06 22:37:38

当我使用Windows 7 64位时,通过第一次运行WDK setenv.bat <path_to_wdk> x64解决了这个问题。然后,使用midl netcfg.idl /env x64 (64位TLB)或midl netcfg.idl (32位TLB)生成类型表。

我选择使用生成64位TLB

希望它能帮助那些刚刚接触到这只COM怪兽的人!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22897409

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档