How can i change current state of a windows service from a C/C++ program ??
for example say, Mysql is running as a service and its current status is ‘Started’… how can I check the status and how can i change its status from a c/c++ program? like if I want to change its status from ‘Started’ to ‘Stopped’ – how can i do it in c/c++?
QueryServiceStatuscan be used to determine the status of a service.Look at the other Service functions to change the status. There is even a complete Starting a Service example (and the matching Stopping a Service code).