I am using the service controller in C++ to manage a windows service.
I can use the StartService( ) and ControlService( ) functions to start and stop the service.
However, is there a standard way to wait for the service to actually start and stop?
I could obviously loop calling QueryServiceStatusEx( ) and wait until the status is Running or Stopped respectively.
Is there a neater way of achieving the same?
Thanks.
Afaik Service start and stop create windows event log events. Maybe you could install a handler for those and wait for the event from your application. If your application is also a service mark it as depending on the 3rd party service then you should not have to wait on it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With