473,394 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How do a trap a process kill attempt?

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
4 4677
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: bobdydd | last post by:
Hi Everbody I am trying to trap the error that SHOULD occur when there is no internet connection. Private Sub CmdPayHere_Click() On Error GoTo Err_CmdPayHere_Click...
1
by: Mullin Yu | last post by:
But, I want is that I can have a Main app that will start a new process or kill one particular or all process. The process will open a console exe. But, I don't want the user to close the console...
0
by: Sam Marrocco | last post by:
I seem to be having a devil of a time killing a process.... If I launch an applicaton such as notepad.exe as a Process, I can kill it with no problem. However, if I launch a particulare...
5
by: Brett | last post by:
How do I gracefully kill a process than restart it? The process Image Name is known. Thanks, Brett
16
by: LP | last post by:
Hello, I am trying to use .NET with Excel. I installed Office 2003 and selected ..NET programming suport option, so it installed all those PIA, as MS sugests. But I can not find a way to destroy...
22
by: nd02tsk | last post by:
Hello! I have a couple of final ( I hope, for your sake ) questions regarding PostgreSQL. I understand PostgreSQL uses processes rather than threads. I found this statement in the archives: ...
10
by: pemo | last post by:
As far as I understand it, a trap representation means something like - an uninitialised automatic variable might /implicitly/ hold a bit-pattern that, if read, *might* cause a 'trap' (I'm not...
1
by: Newbie Coder | last post by:
In C++.NET 2003 Windows Forms App I fill a ListView control with process name & second column is the Process ID. I would like to kill the selected process, which is simple in VB.NET or C#,...
4
by: Richard Rossel | last post by:
Hi Fellows, I have a problem with process termination. I have a python code that apache runs through a django interface. The code is very simple, first, it creates a process with the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.