[python-win32] COM sending and receiveing events

Tim Golden mail at timgolden.me.uk
Mon Jun 22 10:18:44 CEST 2009


Christian K. wrote:
> Hi,
> 
> I apologize for my ignorance about COM programming in advance. I would like to
> be pointed to an example of how I could send a message from a subthread of a COM
> server back to the main thread. Being an outlook addin, the COM server is
> already reacting to a couple of Outlook generated events. Now it would like to
> add my own simple event handling and generation code. I have looked in the
> win32com/demos folder and searched on that list, but I think I know too little
> about COM to understand that information.


I'm not entirely clear at what level you're asking. If you
want to pass an object around between threads, you'll need
to marshal it up. Look in pythoncom at:

  http://timgolden.me.uk/pywin32-docs/pythoncom__CoMarshalInterThreadInterfaceInStream_meth.html
  http://timgolden.me.uk/pywin32-docs/pythoncom__CoMarshalInterface_meth.html

and  

  http://timgolden.me.uk/pywin32-docs/pythoncom__CoUnmarshalInterface_meth.html

TJG


More information about the python-win32 mailing list