SelfService GetServiceStatus() gives compiler errors when called

Applies to: the CapeSoft SelfService templates; the thread was posted in the Clarion 9 group and does not name a template chain.

Problem

Calling the SelfService object method GetServiceStatus (string p_ServiceName, *SS_SERVICE_STATUS p_ServiceStatus, long p_Silent=1),long produced compiler errors whatever parameters the poster tried.

Solution

  1. The second parameter is passed by reference, so it needs a real variable of the status type. Declare a group based on SS_SERVICE_STATUS in the procedure's Local Data embed point:
status_grp      group(SS_SERVICE_STATUS)
                end
result          long
  1. Call the method with that group and test the result (0 means the status was read; the group's CurrentState then holds the state):
result = gSelfService.GetServiceStatus('MyServiceName',status_grp,0)
if not result
  case status_grp.CurrentState
  of SS_SERVICE_STOPPED
  of SS_SERVICE_RUNNING
  end
end
  1. A second poster's code does the same with a group named after SS_SERVICE_STATUS and a class instance svc, and passes TRUE for the silent parameter.
  2. The original poster reported that the missing status group in Local Data was his problem.

Caveats

  • The thread shows posted code, not the template documentation; check the method prototype in your installed SelfService version.
  • One poster has used the method for a long time without trouble. Another asked whether it is reliable and said he had read the service state from a DOS request instead; nobody compared the two.

Today (2026)

Likely unchanged, since the cause is a plain parameter type. Not re-tested against a current SelfService release.

Sources: Rupert E. (Oct 2015, the question), Graham D. (Oct 2015), Jeff S. (Oct 2015) in sv.clarion.clarion9.