Reputation: 18251
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.
Upvotes: 4
Views: 1661
Reputation: 598299
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.
Upvotes: 11
Reputation: 34128
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.
Upvotes: 6