On 3/05/2011 9:15 PM, Michael Illgner wrote:
Hi
I have got some questions regarding win32com.client.DispatchEventWithEvents()
Is there any documentation available for this method?
Only the docstring.
I am writing a kind for a network proxy for a custom COM api. and I am
using a simple socket server based on the standard python classes. The
implemented request handler reads some data from the socket,
transforms it suitable for the COM api and send the result back. the
COM objects are constructed in the "main" thread using
win32com.client.Dispatch()
Now I am working on a handler for asychronous COM events, it is
sufficient to replace Dispatch() with DispatchWithEvents() or do I
have to start a new thread for every COM object using an event handler
?
There is nothing magic about events - you need to provide your own magic
:) All the calls are still normal blocking calls - so if you want a
model where methods on your com object are done in the background and
fire when complete, you need to fully arrange for however that happens
(be it threads or other non-blocking features.) A win32 message queue
is often used, which is why it is a common requirement that apps using
such objects must ensure a message loop is running on the main thread.
In my understanding the argument for DispatchWithEvents is a class and
not an instance, so how can i configure or initialize my handler
instance eg. for a handler specific TCP callback ?
DispatchWithEvents takes or creates a COM object, then instantiates a
single instance of the event class and hooks it up with the object - so
there is a 1:1 relationship.
Mark.
Any help or pointers to documentation/examples are greatly appreciated.
Regards
Michael
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32