Hello, <long_winded_explanation>
So I've spent the last couple of days trying to figure out how I can change the bindings on a network adapter. All of my research has lead me to the INetCfg interface (http://msdn2.microsoft.com/en-us/library/ms805265.aspx). It seems as though nobody out there has actually used this interface with python yet (or at least I can't find anything with google). So according to the MSDN docs, the interface is already implemented in netcfgx.dll. So I thought I would just use ctypes, and access it that way. But I took a look at the netcfgx.h file and got scared. I'm not a very competent C/C++ programmer (only dable here and there) and that header file has things I don't understand. Next I realized that INetCfg is a COM interface (I don't understand COM that well either). So I dug through google, and found the CLSID for it, and the IID for INetCfg class, and tried to CoCreateInstance() it (as I saw in several C/C++ examples). I kept getting an error about there being no interface object registered that supports this IID. So I re-read chapter 12 of Mark Hammond's Book and found this gem: "A final note on native interfaces: Python can't support arbitrary COM interfaces; the pythoncom module (or a pythoncom extension) must have built-in support for the interface. Fortunately, there are tools pythoncom developers use that largely automate the process of supporting new interfaces." Ok, clearly pythoncom has no built-in support for this interface. Dooh. So I spend a day digging through google and reading anything I can find. Finally I found a couple of threads somewhere that talk about comtypes. So I am trying to generate a python class that "wraps" the INetCfg interface using comtypes. I found the comtypes pages on the ctypes wiki, and read through that (several times). It suggests the easiest thing to do is generate a type library from the IDL, and use comtypes.client.GetModule() to create the interface automatically. Sweet. So I try to compile the IDL into a TLB using MIDL. oops, can't be done because the IDL does not contain any "library" declarations. Ugggh. </long_winded_explanation> So I am trying to write the interface manually. Now, I am running into IDL flags like "size_is" and "length_is" that don't seem to be implemented in comtypes. Can I safely ignore these? Is there some work around for this? Also, some of the interfaces in the IDL have typedef's in them. Is there some special way of doing typedefs in comtypes, or should I just use ctypes, and define the Structures? Does the definition belong in the class or outside? (does it matter?) What about all the #defines contained in cpp_quote() ... do those get ignored, or should I copy them into my python package? Once I get this all coded up, what do I do with it? Do I then have to write additional classes on top of the 14 interfaces, that actually implement the interfaces? Am I doing this the hard way?? Is there an easier way that I just don't know about? Sorry for the long winded post, but it really reflects just how confused I am. Any help would be greatly appreciated. -Matt ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ comtypes-users mailing list comtypes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/comtypes-users