Winforms password protection
I have a simple WinForms application running in the system tray. Is it possible to protect the password from closing the program if the user tries to close it from the Task Manager?
Ideally, I want the user not to close the process, but if windows are reloaded, I want it to close without prompting. Very similar to antivirus software.
source to share
If the user has the correct permissions, they will be able to kill your process from the Task Manager.
This suggests that @fujiFX mentions the FormClosing event in his comment - a good start and better than nothing.
The FormClosing event occurs when the form is closed. When the form is closed, it is removed, freeing all resources associated with the form. If you cancel this event, the form remains open. To cancel the closing of the form, set the passed event handler for the
Cancel
FormClosingEventArgs propertytrue
.
source to share