By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,916 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,916 IT Pros & Developers. It's quick & easy.

How do a trap a process kill attempt?

P: n/a
I want to trap any attempts to kill my C# application and so that I can
execute shutdown code and let the app die gracefully. How can this be done?
Nov 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Peter Steele wrote:
I want to trap any attempts to kill my C# application and so that I can
execute shutdown code and let the app die gracefully. How can this be done?

I think you worry too much, as long as you do the normal cleanup at the
program exit, it should be fine.

Just imagine how could you trap when people shut down the computer, or
power off :-)

John
Nov 17 '05 #2

P: n/a
John Sun wrote:
Peter Steele wrote:
I want to trap any attempts to kill my C# application and so that I
can execute shutdown code and let the app die gracefully. How can this
be done?

I think you worry too much, as long as you do the normal cleanup at the
program exit, it should be fine.

Just imagine how could you trap when people shut down the computer, or
power off :-)

John

You should try brushing up on your event listeners
Nov 17 '05 #3

P: n/a
This is definitely not worrying too much. It is essential that this
application make every best effort to close down cleanly. If someone shuts
the power off, then clearly there's nothing that can be done...

"John Sun" <js***********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Peter Steele wrote:
I want to trap any attempts to kill my C# application and so that I can
execute shutdown code and let the app die gracefully. How can this be
done?

I think you worry too much, as long as you do the normal cleanup at the
program exit, it should be fine.

Just imagine how could you trap when people shut down the computer, or
power off :-)

John

Nov 17 '05 #4

P: n/a
Subscribe to the AppDomain.CurrentDomain.ProcessExit event - this gets fired
when the application is terminating cleanly and while all system components,
appdomains, etc. are still functional.

"Peter Steele" <ps*****@z-force.com> wrote in message
news:Ol**************@TK2MSFTNGP10.phx.gbl...
I want to trap any attempts to kill my C# application and so that I can
execute shutdown code and let the app die gracefully. How can this be done?

Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.