Re: Run code EVERY time something closes



Scott,
Is this a Windows Forms app?

If so:

Have you looked at using the Application.ApplicationExit event?

In addition to the Application.ThreadException &
AppDomain.UnhandledException events?

The ApplicationExit event should let you know when your app is exiting
normally, while the ThreadException will prevent exceptions during "window
event processing" from killing your app, and UnhandledException will let you
know when your app is not exiting normally.

--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley - http://www.tsbradley.net


"Scott M" <scott_M@xxxxxxxxxxxxx> wrote in message
news:u0jJMfC0FHA.2924@xxxxxxxxxxxxxxxxxxxxxxx
|I have a procedure in my Dispose method that records my application was
| closed in a database. However, when I kill a process or an unhandled
| exception occurs this does not seem to run. Is there some code that is
| GUARANTEED to run EVERY time the code exits? I don't mind if it runs
during
| garbage collection or whatever. I just need it to run to log the
| application closing for compliance reasons.
|
| Thanks in advance
| Scott
|


.



Relevant Pages

  • Re: Windows.. its like coming home!
    ... gradual transition, especially in going from OS 9 to OS X. ... They needed something that could compete with Windows, ... mean by the "2 of every app" comment before - Apple took whatever apps ... I've found that because the Dock shows applications rather than windows, ...
    (comp.sys.mac.advocacy)
  • Re: Windows.. its like coming home!
    ... gradual transition, especially in going from OS 9 to OS X. ... They needed something that could compete with Windows, ... mean by the "2 of every app" comment before - Apple took whatever apps ... I've found that because the Dock shows applications rather than windows, ...
    (comp.sys.mac.advocacy)
  • Re: Frustration level with Windows -- ARG!
    ... I can have an app sieze and you can go take a ten ... That is MS-Outlook, not Windows. ... to the processes tab, not the applications tab. ... and it tries to stop them "gently" if it can, before resorting to kill -9. ...
    (comp.sys.mac.advocacy)
  • RE: Beginners Questions
    ... We do use Windows form on the presentation layer which is on ... terminal server and call web services on the business logic side. ... of using "proxy" authentication on SQL Server. ... > I have written an app with a Windows Forms UI that is deployed to clients ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: DOS applications ?
    ... A DOS batch file runs dos programs sequentially and can run ... command prompt window and keep the second command ... Windows APIs to do it. ... A 16-bit DOS app running on pure MS-DOS cannot launch another app ...
    (microsoft.public.vc.mfc)