展开全部
如果你想写任务管理器,Process可以获得多数的进程信息,CPU使用率要自己计算, 进程用户名、命令行可以用WMI获取具体你自己查查
using System.Diagnostics;
private void button1_Click(object sender, EventArgs e)
{
Process process = Process.GetCurrentProcess();
MessageBox.Show("当前进程名:" + process.ProcessName
+ "\nPID:" + process.Id
+ "\n进程路径:" + process.MainModule.FileName
+ "\n线程数:" + process.Threads.Count
+ "\n句柄数:" + process.HandleCount
+ "\n内存使用:" + process.WorkingSet64.ToString()
+ "\n虚拟内存:" + process.VirtualMemorySize64.ToString());
}
using System.Diagnostics;
private void button1_Click(object sender, EventArgs e)
{
Process process = Process.GetCurrentProcess();
MessageBox.Show("当前进程名:" + process.ProcessName
+ "\nPID:" + process.Id
+ "\n进程路径:" + process.MainModule.FileName
+ "\n线程数:" + process.Threads.Count
+ "\n句柄数:" + process.HandleCount
+ "\n内存使用:" + process.WorkingSet64.ToString()
+ "\n虚拟内存:" + process.VirtualMemorySize64.ToString());
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询