> I've done a delphi-written windows service, it's running in my
> server, and I need to make it fail uder certain circumstances to let
> windows take the appopriate action (i.e., first restart the service,
> and, if the circumstances don't change, restart the server).
> I've checked delphi help and the web and found no way to do it.
> Anyone knows how can I make it?
Sorry Marco, I dont quite follow the question so I'll answer best I can.
For the service to fail it needs to end with an exit code.
To make windows take action you need to set that in the services area,
you can change the recovery tab to take the appropriate actions. I
believe its in the registry, certainly the startup states of services
are (having had to rescuce servers that have been tightened a tad too
far)
Take a look at HKLM\System\Services\ControlSetxxx\<service name>
I've done a delphi-written windows service, it's running in my server, and I
need to make it fail uder certain circumstances to let windows take the
appopriate action (i.e., first restart the service, and, if the
circumstances don't change, restart the server).
I've checked delphi help and the web and found no way to do it. Anyone knows
how can I make it?
Thanks in advance!
Marco
Thanks for replying. I know how to tell windows what to do when a service
fails, but I don't know how to make a delphi-made service fail. I mean, I
don't have a command "fail" in TServiceApplication. I've already tried to
call Self.Free, but windows didn't recognize it as a fail.
Regards,
MARCO
"Liz" <liz_want...@xcalibur.nospam.co.uk> wrote in message
news:41ace7e6$1...@newsgroups.borland.com...
> Thanks for replying. I know how to tell windows what to do when a
> service fails, but I don't know how to make a delphi-made service
> fail. I mean, I don't have a command "fail" in TServiceApplication.
> I've already tried to call Self.Free, but windows didn't recognize it
> as a fail.
No because it exited cleanly, it needs to return an error code, or have
an exception.
I havent made a delphi service for a long time, I think you can also
report back to the control manager that there was an error.
try halt(1); This will result in returncode 1 instead of 0 (which would
be "no error").
Greetings
Markus
Thank you both for your help. Halt(1) solved it.
Regards,
Marco