C#有关进程的操作
using System.Diagnostics //包含了能够与系统进程,事件日志,和性能计数器进行交互的类
System.Management 命名空间
提供对大量管理信息和管理事件集合的访问,这些信息和事件是与根据 Windows 管理规范 (WMI) 结构对系统、设备和应用程序设置检测点有关的。应用程序和服务可以使用从 ManagementObjectSearcher 和 ManagementQuery 派生的类,查询感兴趣的管理信息(例如在磁盘上还剩多少可用空间、当前 CPU 利用率是多少、某一应用程序正连接到哪一数据库等等);或者应用程序和服务可以使用 ManagementEventWatcher 类预订各种管理事件。这些可访问的数据可以来自分布式环境中托管的和非托管的组件。
C#获取cpu占有率,内存占有率,磁盘占有率,进程信息
http://www.cnblogs.com/kevinGao/archive/2011/12/09/2671025.html
1.Visual Studio 2008中进行对应用程序的UAC设置
(1) 打开Begin项目(C:\Course\HOL\使用Manifest\Begin)
(2) 按F5执行,没有任何问题,如右图:
(3) 关闭程序,到目录C:\Course\HOL\使用Manifest\End\WindowsFormsApplication1\bin\Debug,我们看到WindowsFormsApplication1.exe的图标上没有盾牌,刚刚执行时,也没有提示权限提升。
(4) 在项目上点击右键,选择Add->New Item…
(5) 找到项目“Application Manifest File”,名字为:app.manifest,点击”Add”按钮。
(6) 将下面这段代码:
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
< requestedExecutionLevel level ="asInvoker" uiAccess ="false" />
替换成
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
< requestedExecutionLevel level ="requireAdministrator" uiAccess ="false" />