参考 MSDN "Services"SC_HANDLE OpenService( SC_HANDLE hSCManager, // handle to SCM database LPCTSTR lpServiceName, // service name DWORD dwDesiredAccess // access );BOOL QueryServiceStatus( SC_HANDLE hService, // handle to service LPSERVICE_STATUS lpServiceStatus // service status );BOOL ControlService( SC_HANDLE hService, // handle to service DWORD dwControl, // control code LPSERVICE_STATUS lpServiceStatus // status information );
SC_HANDLE hSCManager, // handle to SCM database
LPCTSTR lpServiceName, // service name
DWORD dwDesiredAccess // access
);BOOL QueryServiceStatus(
SC_HANDLE hService, // handle to service
LPSERVICE_STATUS lpServiceStatus // service status
);BOOL ControlService(
SC_HANDLE hService, // handle to service
DWORD dwControl, // control code
LPSERVICE_STATUS lpServiceStatus // status information
);