wntSvcStatus

Started by bettman, July 30, 2014, 08:25:38 AM

Previous topic - Next topic

bettman

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

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

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

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.