I'm developing service application that must restart itself. What are the ways of doing that? Is it possible to ask system start application again if it is stopped? I'm using Delphi 2007.
Your service can programably configure recovery options for itself by calling the Win32 API ChangeServiceConfig2()
function inside of its AfterInstall
event. Set the dwInfoLevel
to SERVICE_CONFIG_FAILURE_ACTIONS
and set the lpInfo
to point at a SERVICE_FAILURE_ACTIONS
record describing what you want to happen when the service fails.
If you go into services.msc
you can configure this for you service. You don't have to do it in code. See the Recovery tab when you open the properties of you service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With