How to catch kill application

  • Thread starter Thread starter Tommaso Caldarola
  • Start date Start date
T

Tommaso Caldarola

How to I catch task manager killing application event
or accidentally switching off the computer?
 
Tommaso Caldarola said:
How to I catch task manager killing application event
or accidentally switching off the computer?


If you mean catching "End Process" when you say "killing, then the answer is you can't. The
same is true for a power off switch, it can't be catched.

Willy.
 
Tommaso Caldarola said:
How to I catch task manager killing application event
or accidentally switching off the computer?

Define "catch". As has been mentioned, there's no way to "catch" events
like that in the sense that you handle them as they happen.

However, if what you want is to *detect* the situation after the fact so you
can try to clean up, you can use the same mechanism a variety of other
software uses, including Windows. That is, create some temporary stored
object (like a file or a registry key, for example) that you delete when you
exit normally. When your program runs, it checks for that object and if the
object is still present, your program was not able to exit normally (which
could be due to the task being killed, or the computer being switched off,
for example).

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top