如何在vc ++中检测服务 [英] how to detect the services in vc++
本文介绍了如何在vc ++中检测服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用VS2005并尝试创建一个显示当前正在运行的服务的程序,并发现特定服务是否正在运行。
任何人都可以告诉我为实现这个目标必须做些什么。
我正在研究vc ++。
谢谢,
Vaibhav Jaiswal
I''m using VS2005 and am try to create a program which shows the current running services and found that particular service is running or not.
Can anybody tell me what I have to do for achieving this.
I am working on vc++.
Thanks,
Vaibhav Jaiswal
推荐答案
参见 EninServicesStatusEx [ ^ ] API函数。
See the EnumServicesStatusEx[^] API function.
这很简单,你只是需要使用2个WinAPI:OpenSCManager
和EnumServicesStatus
。第一个用于获取服务控制管理器句柄,第二个用于根据给定的状态和类型枚举服务。
问候,
Maxim。
That is very easy, you just need to use 2 WinAPI:OpenSCManager
andEnumServicesStatus
. First one is used to obtain service control manager handle, and the second one to enumerate services based on given status and type.
Regards,
Maxim.
这篇关于如何在vc ++中检测服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文