[python-win32] How to implement a COM interface (that is notpart

Mark Hammond mhammond at skippinet.com.au
Fri Sep 22 04:18:31 CEST 2006


> Thanks for your help -- I searched around some more and I think I
> have the basic idea down -- if you want to implement a COM
> interface, it should
> look something like this:

That all looks correct!

> import win32com.server.util
> qnotify = win32com.server.util.wrap(Q())

Try adding useDispatcher=1 as a param to wrap.  That will cause the object
to use a "debug" dispatcher, and should spew print statements to
win32traceutil - ie, the same as if the object was registered with "--debug"
(but as this object is not registered at all, --debug isn't an option; the
param to wrap is though).

> Sometimes the OnQuoteData callback is
> invoked with an int (the int is 1240772, if that means anything)
> instead of the quote datatype as advertised. Sometimes the interpreter
> crashes.

Ack - that can't be good.  What is the makepy generated code for
OnQuoteData?

> However, I suspect that the above code is correct, unless I
> am still doing something wrong.  (Perhaps using wrap is not the right
> function for creating an object that is passed as an argument to
> another COM function?)

It all looks ok to me, so I'm not really able to offer much more help at
this stage.

Mark



More information about the Python-win32 mailing list