How do I access COM object's nondefault interface?
nallanews at bluewin.ch
Sat Aug 17 17:00:17 EDT 2002
Josef Sachs wrote:
> Can anyone tell me how to access a COM object's nondefault interface?
I had the same question and after searching the net and watching source
(win32com/...) i come to this hack:
class x with default interface X
class y with default interface Y
class y implements the interface Z too
class x has a member (m) wich return a object y through the interface Z
# y has now the Z interface
y = x.m
# y has now the 677...5A9 interface - Y interface
y = win32com.client.Dispatch(y, 'm',
I don't know if this hack is usefull for you. But I don't like it, because:
- I need the tool makepy
- the second parameter could be anything, the eg. I found used the name
of a member function from the class x?!?
- the third parameter should be a name of the form "library.class",
instead the CLSID
If I use the tool makepy to generate python code for early binding, I
can not belive why I have to type somthing like this
x = win32com.client.Dispatch("library.class")
x = library.class.
But this is stuff for a new thread.
OK. my english experience are better than python ;) That mean I use
python just four days now and its great. I hope someone has a better
solution to change the interface.
More information about the Python-list