Hi List, Hopefully I have my terminology right, I'm pretty new to COM and C++.
My problem is that I have a COM DLL written in C++, that I would like to call from Python. This DLL implements 3 important interfaces, each of which is also an IDispatch implementation, like the following: IDispatchImpl<Interface_1, &__uuidof(Interface_1), &LIBID_Interface_1, 1, 0> IDispatchImpl<Interface_2, &__uuidof(Interface_2), &LIBID_Interface_2, 1, 0> IDispatchImpl<Interface_3, &__uuidof(Interface_3), &LIBID_Interface_3 1, 0> However, when I do: >>> obj = win32com.client.Dispatch("a.b.c") >>> obj <COMObject a.b.c> The object I get only has methods available for the first of the interfaces. From my reading, this is simply the functionality of IDispatch, and if I wanted to get those additional methods through IDispatch, I would have to update the DLL, and restructure my interfaces. I'm not confident enough in my C++ to do this, or at least it's not my first choice. >From what I've read, there are two ways that seem to be possibilities for being able to call the methods from the other interfaces. The simplest one I found was the suggestion to use MakePy on the type library containing Interface_2 and Interface_3. I did this, and copied the generated file to my working directory, then did: >>> from interfaces import Interface_2 >>> obj_i2 = Interface_2(obj) >>> obj_i2 <win32com.gen_py.typelibname 1.0 Type Library.Interface_2 instance at 0x17459602> Unfortunately when I try: >>> obj_i2.secondaryMethod() Traceback (most recent call last): ... File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line 449, in _ApplyTypes_ dispid, 0, wFlags, retType, argTypes, *args), com_error: (-2147319779, 'Library not registered.', None, None) The other suggestion I came across was to use QueryInterface. I wasn't sure what argument to pass to QueryInterface, so I tried using the CLSID of the interface I wanted. >>> obj._oleobj_.QueryInterface(Interface_2.CLSID) Traceback (most recent call last): File "<interactive input>", line 1, in <module> TypeError: There is no interface object registered that supports this IID >From these error messages, it seems like perhaps there's a problem with the registration of the type library that contains the interfaces. I'm not really sure how to fix that, or if that is even the problem. Any ideas? Thanks, Alec Munro _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32