我正在尝试使用IDL 在这一页生成INetCfg接口的类型,如下所示:
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加载,下面给出了代码:
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
发布于 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怪兽的人!
https://stackoverflow.com/questions/22897409
复制相似问题