[python-win32] Success with COM Connection Point event handling

Craig H. Anderson craig at coot.net
Fri Oct 15 18:44:12 CEST 2004


I want to report that I've had success
with COM Connection Point event handling.
I ran makepy.py on the vendor DLL and it generated the event
method signatures used in class IvrEventHandler 

Thanks again to Mark Hammond for the wonderful software and
answering my questions. 

Code fragments from my working script: 

class IvrEventHandler:
   target = None # must be set to object that handles 
OnPDSBadData(),OnPDSEvent()
   def __init__(self):
       pass
   def OnPDSBadData(self,
                    cause=pythoncom.Empty,
                    Msg=pythoncom.Empty):
       IvrEventHandler.target.OnPDSBadData(cause,Msg)
   def OnPDSEvent(self,
                  ErrFlag=pythoncom.Empty,
                  command=pythoncom.Empty,
                  CmdType=pythoncom.Empty,
                  data=pythoncom.Empty):
       IvrEventHandler.target.OnPDSEvent(ErrFlag,command,CmdType,data) 

class TestClass:
  def Run(self):
       self.SerStart = win32com.client.Dispatch('VRNexusS.IServerStartup')
       self.IVRNexus = self.SerStart.GetIVRNexus
       self.VrServer = 
win32com.client.DispatchWithEvents(self.IVRNexus,IvrEventHandler) 

       for ii in range(60):
           time.sleep(1)
           pythoncom.PumpWaitingMessages() 


More information about the Python-win32 mailing list