[python-win32] Python-win32 Digest, Vol 33, Issue 12
wccppp
wccppp at gmail.com
Sat Dec 10 09:09:53 CET 2005
>
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20051209/cba61e0e/attachment.htm
More information about the Python-win32
mailing list