Generally that is not possible, especially by a code in your application. The application itself has no control over this.
The most that is possible is not giving privilege to close (TERMINATE
) the process when installing the program. But this does not completely solve. Thankfully no software can do this.
The user can prevent the software from running automatically at the next startup and it will definitely kill your program easily. So it’s not worth the effort.
If he knows what he’s doing it’s possible to give the privilege on its own without having to give one boot on the machine. There are specialized software that kills processes that cannot be killed. The Process Explorer from Microsoft can help do this.
Surely there are some possible tricks like capturing the NtTerminateProcess
in the kernel or create another program that monitors this main one. But no trick is effective. What’s worse is that you think you’re protected when you’re really not.
Forget this idea.
Your question is weird. Do you want to remove or what to prevent you from removing from the task manager? Or what you want is to prevent the program from being shut down in any way?
– Maniero
Another issue worth considering, the user who can close the process has administrator permissions?
– Omni
I think it just wants to stop the user from finishing the process, but the process itself can end, as some antivirus work (which run at a blocked access level).
– Guilherme Nascimento
Sorry for the confusion in the question, the user has administrator permission and do not want the user to close the application.
– Pedro Soares
There is a way, use Hooks.
– Frederico Cruz