qawsedstation wrote:I need an VCL application that will not close ever from the user.
The user has final say over what runs on their machine. If they don't want your app running, they are free to kill it. You should not be trying to prevent that. To change that, you would have to run the app under a different user account that the user does not have permissions to.
qawsedstation wrote:or may be closed by task manager but reopens automatically or hide from task manager
To hide from Task Manager, you would basically have to write a rootkit, which is bound to trigger security/antivirus alerts.
A killed app cannot auto-restart itself. You would need to create and run a separate process that monitors the main process that you want to restart. But then the user can always kill the watchdog process first, so it is a kin of catch-22.
On Windows 2000 and later, at least, a service can register itself with the SCM via ChangeServiceConfig2(SERVICE_CONFIG_FAILURE_ACTIONS) to indicate that it wants to be auto-restarted if it dies unexpectedly.