Passing object as param to Python COM server

Jeff Shannon jeff at ccvcorp.com
Fri Nov 23 19:31:10 CET 2001


Graham Fawcett wrote:

> Following up to my own message, in case anyone else needs the answer
> (or, more likely, I forget it and end up back at Google...)
>
> You need to wrap the argument using win32com.client.Dispatch:
>
> def QueryApp(self, app):
>   #Name should be a valid attribute of a PowerPoint.Application
>   app = win32com.client.Dispatch(app)
>   print app.Name # or whatever else you want to do.
>

I don't recall specifics, but you may want to look into the wrap() and unwrap()
functions as well--I believe these add (and remove) the python wrapper-classes
around existing COM objects.  I *think* that Dispatch() does a bit more than what
you want, here....  but I'm not really sure.  :)

Jeff Shannon
Technician/Programmer
Credit International





More information about the Python-list mailing list