Accessing secondary COM interface with win32com

Mark Hammond mhammond at skippinet.com.au
Wed Mar 15 22:55:34 CET 2000


Im not sure what you are asking.

If you need to use custom COM interfaces defined by your app, then you
are out of luck.  You will need to get down at the C level (although
we have tools that will help generate the code).

If you simply want to use a different IDispatch interface from an
object - you should be able to do something like:

old_interface = win32com.client.Dispatch(Your.App")
module = gencache.GetModuleForProgID("Your.App")
new_interface = module.NewInterfaceName(old_interface)

Mark.

"D. Ellis" <dellis_moreinc at yahoo.com> wrote in message
news:8aonqf$8o7$1 at sloth.swcp.com...
> I'm new to python, but it seems very cool.  I want to use it to help
test a
> Windows application I'm working on. I'm trying to use win32com to
test a COM
> server (written in C++).  I can easily create instances of objects
via
> pythoncom.new() and win32com.client.Dispatch(), but for some of
these
> objects I need to use multiple COM interfaces.  What is the correct
way to
> use multiple interfaces on these objects?  How do I refer to the IID
> symbolically (instead of literally)?  They seem to be buried in the
module
> generated by makepy and stored as the values (instead of keys) in a
> dictionary used (internally, I presume) by
win32com.client.CLSIDToClass.  I
> just want to be able to access these classes or IIDs in my program.
>
> Any help is greatly appreciated.
>
>





More information about the Python-list mailing list