I am trying to generate typelib of INetCfg interface using IDL in this page, seen below:
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;
};
Unfortunately, the generated IDL still can't be loaded from comtype, with code given below:
import comtypes.client as cc
cc.GetModule("C:\path\to\netcfg.tlb")
It gives this error WindowsError: [Error -2147312566] Error loading type library/DLL
How do I fix this error? I am using Windows 7 64 bit, and Python 27 64
As I use Windows 7 64bit, just solved this issue, by first running WDK setenv.bat <path_to_wdk> x64
. After that, generate the typelib either using midl netcfg.idl /env x64
(for 64bit TLB) or midl netcfg.idl
(for 32bit TLB).
I opted to use generate the 64bit TLB
Hope it helps somebody who just get in touch with this COM beast!