Using Python COM objects from C++
Syver Enstad
syver at NOSPAMcyberwatcher.com
Thu Jan 11 22:06:46 EST 2001
"Syver Enstad" <syver at NOSPAMcyberwatcher.com> wrote in message
news:ixe76.2667$k25.38410 at news1.oke.nextra.no...
> I don't know if this has been answered before here but..
>
> I know how to call the python COM object using "pure" IDispatch, but is it
> possible to make a type library and ensure that the Python class
> implementing the COM complies with it?
>
> The problem would be the dispatch id's as far as I can see. I don't know
how
> to specify the dispatch id's that the method's in the python object should
> have.
>
I found an okay solution.
Make your python com object just as you use to, but:
Make the class variable _public_methods_ empty, like this.
_public_methods = []
Make a class variable _dispid_to_func_ that is a dictionary mapping dispids
to function names. Like this:
_dispid_to_func_ = {0x1:'Dummy', 0x2:'Swear'}
If you want to implement a dispinterface from a typelibrary/idl file adjust
the _dispid_to_func_ dictionary so it matches the idl.
More information about the Python-list
mailing list