windows - C# catch kill command -
How can I catch windows taskkill command to avoid this?
You can not not prevent a program from hitting your process The only way to keep alive is to complete the process to ensure that it is the second watchdog application that is constantly running.
So, you have two apps; APP (Main) and APB (Watchdog)
apa
check ifAPP
is running. If not, thenAPP
startsAPP
.
APP
checks ifapa
is running. If not, thenAppB
startsAPP
.
But this is usually a design for the malicious process, so I hope you are not unpleasant about anything.
You can see the following events in the message queue when the end process is clicked:
WM_CLOSE // UI app
CTRL_CLOSE_EVENT // console app
But if your app does not shut down on time, the kill command will be sent, which can not be captured.
Comments
Post a Comment