Marko
Marko

Reputation: 191

Make service self install in delphi

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

Upvotes: 19

Views: 5227

Answers (1)

David Heffernan
David Heffernan

Reputation: 613521

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.

Upvotes: 28

Related Questions