[python-win32] Passing an IDispatch pointer

Mark Hammond mhammond at skippinet.com.au
Wed Oct 6 11:34:33 CEST 2004


> If a Python call to a COM server passes an IDispatch class (ie:
> pointer), could the COM server then potentially just call a method on
> that class?

Yep - you will probably need to call win32com.client.Dispatch() with the
object to wrap it into a friendly object though.

> The reason I ask is because there was a question about a
> COM server firing events such that the communication between the COM
> server and the Python client was asynchronous.  If the COM
> server could
> hold an IDispatch pointer to the Python client, and can call
> methods on
> that passed in class, then we have a solution for
> asynchronous calling
> don't we?

That depends on where you are calling from and on the COM threading
apartment you are calling from, but yes, COM does allow asynchronous
behaviour (via connection-point based events or otherwise)

Mark



More information about the Python-win32 mailing list