Resource Clean-up if process killed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to listen for a kill message (that is, the process is
terminated) in a managed application.

The scenario is that if the process is killed, I'd like to clean up files
that were written to the user's temp directory.

Cheers
 
Is it possible to listen for a kill message (that is, the process is
terminated) in a managed application.

Do you mean from within the process itself or from a separate process?
There's no "kill message" AFAIK, and when you "kill" a process it gets
no chance to execute cleanup code. That's why using a more graceful
way of terminating an application is preferred.


Mattias
 
From a seperate process, ie. can I catch the user killing the process via the
task manager?

Cheers
 
Back
Top