可能重复:
Querying if a Windows Service is disabled (without using the Registry)?检查服务是否正在运行?
我需要检查,如果 '事件日志' 服务正在运行。怎么做?
可能重复:
Querying if a Windows Service is disabled (without using the Registry)?检查服务是否正在运行?
我需要检查,如果 '事件日志' 服务正在运行。怎么做?
使用OpenSCManager(),然后使用OpenService(),然后使用ControlService()。
您可以执行
>sc query Eventlog
,并检查结果。
使用Win32 API的一些示例代码可以找到here。