Link to home
Start Free TrialLog in
Avatar of WebWolf1
WebWolf1

asked on

get status of service in delphi

I wrote a service application in delphi. is there any easy way to query the status of service (if its running or not)? I need way inside the service application.
ASKER CERTIFIED SOLUTION
Avatar of Hypo
Hypo
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WebWolf1
WebWolf1

ASKER

please read again my post. i want a function or a way to get service status from the service application. inside the service application.

example you provided is to query service status from any other application (desktop app).
Ok, sorry,
that wasn't really clear to me by just reading your question.

Anyway, you could still use the service control manager and the same function to do that test, even if you did the test, on your own service, from your own service. But maybe that is just not the way you want to do it? If it's not, then the TService class has a Status property of type TCurrentStatus, from which you could read the status from instead.

If this is not what you are after, then I think you need to explain a bit more of what you are trying to acheive.

regards
Hypo
Avatar of SteveBay
I dont believe it is possible to check the status of a service application that is not running or paused as there is no event upon which to run a function that checks the status. If you are able to check the status of the service, then by definition the status is "Running"
Nonetheless, you could keep track of the status by maintaining a status variable in the various events, OnStart, OnPause,OnContinue etc.
SteveBay is 100% correct.

If your service is stopped, paused or hung, there is no way within that service app that it can possibly query itself to see if it is running.

You would have to do this from some other watchdog service or application.

John