Hello, had the same problem, but now it's solved :)
Take a look at the code below:
class VisualDSP_AppEvents:
def OnAppClose(self):
print '<VisualDSP_Manager> Visual DSP++ has been closed, program
will terminate now!'
class VisualDSP_ProcessorEvents:
def OnHalted(self,ReasonCode,HaltReason):
print '<VisualDSP_Manager> <event : processor halted>'
app = DispatchWithEvents('VisualDSP.ADspApplication',VisualDSP_AppEvents)
...
processor = session.ActiveProcessor
processor_events = WithEvents(processor, VisualDSP_ProcessorEvents)
Here I'm catching application event with DispatchWithEvents
for the processors event that depends on app I've used WithEvents function,
So for your problem try something like:
class session_event_class:
def BeginClose(self):
print 'catched'
acad = win32com.client.DispatchWithEvents("AutoCAD.Application", ACADEvents)
active_session = acad.ActiveSession
active_session_events = WithEvents(active_session,session_event_class)
or
WithEvents(active_session,session_event_class)
active_session_events is usefull if you've done a main class and you
want your event class methods access your main class methods.
Laurent
Laurent,
Thank you very much for your reply. I followed your code and got what I was after without a problem.
- wcc
_______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32