viewpoint-particle

Author Topic: wntSvcStatus  (Read 2597 times)

bettman

  • Newbie
  • *
  • Posts: 41
wntSvcStatus
« on: July 30, 2014, 08:25:38 am »
Greetings,

Just wanted confirmation on the usage of wntSvcStatus when checking for the existence of a service. Will the aforementioned function return a 1 if the service exists and a 0 if it does not?

Thank you.

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: wntSvcStatus
« Reply #1 on: July 30, 2014, 09:11:42 am »
WntSvcStatus with a request of 0 (ServiceExist) will returns @FALSE(0) if a service doesn't exist. If the service does exist, it will return a non-zero value.

Code: Winbatch
AddExtender('wwwnt34i.dll',0,'wwwnt64i.dll')
result = wntSvcStatus("", "SampleServiceName", 0, 0)
If result
   Pause('wntSvcStatus-ServiceExist','Service Exists!')
Else
   Pause('wntSvcStatus-ServiceExist','Service Does Not Exist!')
Endif
Exit
Deana F.
Technical Support
Wilson WindowWare Inc.

bettman

  • Newbie
  • *
  • Posts: 41
Re: wntSvcStatus
« Reply #2 on: July 30, 2014, 09:18:37 am »
I did see that in the help file; in my testing, a 1 was always returned if a service existed and a 0 if not found. Are you saying that different values could be returned based on found/not found? The reason I'm asking is I'm checking for the existence of three services and adding the results to a variable. If the combined results = 3, my script will advance otherwise it will loop until all three services are found.

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: wntSvcStatus
« Reply #3 on: July 30, 2014, 09:44:08 am »
Yes you can probably expect a return value of 1 if the service exists. However the documentation does seem to indicate it can be a positive integer. To be safe you could create your own counter and increment by one on each positive result.
Deana F.
Technical Support
Wilson WindowWare Inc.