Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make service self install in delphi

Tags:

service

delphi

Does anyone know how to make service application in Delphi which install it self by running exe file.

like image 364
Marko Avatar asked Apr 17 '12 08:04

Marko


1 Answers

A Delphi service, created using the TService class, results in an executable that supports self-registration. Call it like this:

serviceexefilename.exe /install

Naturally you need elevated rights for this to work, just as you do for any mechanism that installs a service.

In the other direction use /uninstall to reverse the process. Use /silent to make the registration process, well, silent.

Should you wish to customise the installation process you can provide event handlers BeforeInstall, AfterInstall, BeforeUninstall, AfterUninstall. For example, a common use of AfterInstall is to supply a description for your service since the basic TService code does not.

like image 140
David Heffernan Avatar answered Sep 21 '22 06:09

David Heffernan