Talk:Service - Functions to Start, Stop, Install, Remove a Service

From ISXKB

Revision as of 06:15, 6 February 2007 by Oliverbock (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

We've had trouble deleting a service immediately after stopping it I've added code to wait until we can confirm it has stopped. The article says you should wait for a few seconds but does not include any code!

repeat
   Sleep(500);
   if not QueryServiceStatus(service, status) then
      RaiseException('Could not determine status of service while stopping: '+SysErrorMessage(DLLGetLastError));
until status.dwCurrentState <> SERVICE_STOP_PENDING;
Personal tools
Ads: