c# Process监控进程 与 ManagementEventWatcher 监控进程
生活随笔
收集整理的这篇文章主要介绍了
c# Process监控进程 与 ManagementEventWatcher 监控进程
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1.使用Process监控->播放器的打开与关闭,这里的案例主要监控了Windows播放器和暴风影音播放器,过程中使用了Timer定时监控,但在实际的项目中不建议这样使用,会浪费电脑的性能,最好是能够以自动回调的方式去实现,以下是一个参考。
2.引用:
using System.Collections.Generic; using System.Diagnostics;3.代码:
private Dictionary<string, bool> _allPlayerList;/// <summary> /// 播放器集合[(wmplayer)windows播放器,(stormplayer)暴风影音] /// </summary> public Dictionary<string, bool> AllPlayerList {get{if (_allPlayerList == null){_allPlayerList = new Dictionary<string, bool>() { { "wmplayer", false }, { "stormplayer", false }总结
以上是生活随笔为你收集整理的c# Process监控进程 与 ManagementEventWatcher 监控进程的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 爬虫基础:HTTP基本原理
- 下一篇: C# 自制微信登录窗口,100%还原,数