在Services.msc中添加服务时触发事件或存储 [英] Fire an event or store when a service is added in Services.msc

查看:227
本文介绍了在Services.msc中添加服务时触发事件或存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai ALL

我想将所有新启动的服务存储在services.msc中.这可以是一个弹出式事件,告诉用户该服务是新添加的.该列表应保存在文本文件中.这样用户可以知道系统中正在运行的服务.通过C#代码帮助我.预先感谢U.

Hai ALL

I want to store all the newly started services in services.msc. This can be as an event like a pop-up to tell the user that this service added newly. The list should be maintained in a text file. So that the user can know the services that are are running in the system. Help me through c# code. Thank U in advance.

推荐答案

我不确定您要执行的操作是否可取,我的系统运行着大量的服务,因此我得到了如果每个人都引发对话,就会非常恼火.

我也不确定是否可以使用内置的event,尽管对此我可能是错的.

如果我是正确的,那么您将需要定期轮询事件日志以查找新条目,并在找到与服务相关的操作时采取所需的任何操作.

如果对您有帮助,请此处 [
I''m not sure of the advisability of what you want to do, my system runs loads and loads of services and I would get extremely annoyed if each one threw up a dialog.

I am also not sure if there is a built in event that you can use, although I could be wrong on that.

If I am correct then you would need to poll the Event Log periodically for new entries and take whatever action you want when you find one related to a service.

In case it is any help to you here[^] is some code using WMI to access the Event Log.


这篇关于在Services.msc中添加服务时触发事件或存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆