Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: How to make a delphi service fail?

538 views
Skip to first unread message

Liz

unread,
Nov 30, 2004, 3:36:38 PM11/30/04
to
Msangali wrote:

> 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>

Msangali

unread,
Nov 30, 2004, 4:17:35 PM11/30/04
to
Hi, guys,

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


Msangali

unread,
Nov 30, 2004, 4:42:10 PM11/30/04
to
Hi, Liz,

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...

Liz

unread,
Nov 30, 2004, 4:19:11 PM11/30/04
to
Msangali wrote:

> 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.

Markus Humm

unread,
Dec 1, 2004, 1:04:48 AM12/1/04
to
[snip]

try halt(1); This will result in returncode 1 instead of 0 (which would
be "no error").

Greetings

Markus

Msangali

unread,
Dec 1, 2004, 12:27:04 PM12/1/04
to
Markus, Liz,

Thank you both for your help. Halt(1) solved it.

Regards,
Marco


0 new messages