Hi,

I have a windows app that behaves strangely on shutdown.  Basically, the app is using twisted and uses twisted's reactor as the "event loop".  However, on shutdown and compiled as a windows, not console, app, the app never exists the "event loop" but rather just gets killed.  This gives my code no opportunity to release resources it is holding  on to etc.  I have looked at all the py2exe email archives and the site but nothing seems to address how the exe gets "shutdown".  

I am looking for a way for me to run some code when Windows signals a shutdown (or logoff).  BTW I realize this is a possible for a service but want to keep my app as an app for now.

TIA,

Mats