How do I handle the kill signal?

H

Haim

Hi,
I would like to know if there is a way in the .NET to
handle the kill signal if sent to my process.
I want my application to close properly even if the user
is using the task manager to kill the process.
Does anybody know how to do this?

Thanks,

Haim.
 
G

Girish Bharadwaj

I dont think you can. The Task manager kill is essentially a
"TerminateProcess". I dont think there is a way to hook into that. (I could
be wrong).
 
K

Kevin Gale

Haim said:
Hi,
I would like to know if there is a way in the .NET to
handle the kill signal if sent to my process.
I want my application to close properly even if the user
is using the task manager to kill the process.
Does anybody know how to do this?

You can't do this inside or outside of .NET (short of hacking Windows).

Nor as a user would I want you to. If all else fails I want to be able to
terminate instead rebooting like we had to in the bad old days.
 
J

John Saunders

Haim said:
Hi,
I would like to know if there is a way in the .NET to
handle the kill signal if sent to my process.
I want my application to close properly even if the user
is using the task manager to kill the process.
Does anybody know how to do this?

Windows isn't Unix. There aren't any signals, per se, and certainly no kill
signal.

John Saunders
 
W

Willy Denoyette [MVP]

Girish,

You are right, the process is not notified that it is terminating, nor can
it prevent itself from being terminated.

Willy.
 

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

Top