How to manage event of COM objects...

Laurent bidon at bidon.bidon
Mon Dec 5 11:05:15 EST 2005


Hello,

I'm currently trying to use event from a win32 application using it's
COM interface.

To connect to the application I use:

class MyApp_InterfaceManager (Thread):
  ...
  def run (self):
    # First we initialize the COM libraries for current thread
    pythoncom.CoInitialize()
    #Then we connect to the app with event handling...
    self.app = DispatchWithEvents('MyApp',MyApp_AppEvents)

class MyApp_AppEvents:
  OnHalt:
    print "halt event..."

>From here all is ok when the OnHalt event arrives the print is called.
The problem I have is that I need that MyApp_AppEvents class knows the
thread object to call a thread function when the event occurs(for
example I need to toggle a flag)

I've got no idea how to do that!
Anyone has encoutered the problem?
I've tryied to use getevents but with no result...
Help!

Best regards,

Laurent



More information about the Python-list mailing list