得到系统进程和结束某个指定的进程

            System.Diagnostics.Process[] processList =
System.Diagnostics.Process.GetProcesses();             foreach
(System.Diagnostics.Process process in processList)             {      
          if (process.ProcessName.ToString() == “CrystalMines”)        
        {                     MessageBox.Show(“Y”);                    
//process.Kill(); //结束进程                     timer.Stop();          
      }             }

自己想了另一个办法来作

CrystalMines是进程名称不需要exe

澳门新葡亰网站注册,先修改注册表:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service\PerfProc\Performance
下的:Disable Performance Counters 的值改为0

文章由爱资料原创本文地址:

得到系统当前进程,加入到listBox中:
System.Diagnostics.Process[] processOnComputer =
System.Diagnostics.Process.GetProcesses();
foreach ( System.Diagnostics.Process p in processOnComputer )
{
this.listBox1.Items.Add(p.ProcessName);
}

关闭某个指定的进程:
System.Diagnostics.Process[] process =
System.Diagnostics.Process.GetProcessesByName(this.listBox1.SelectedItem.ToString());

foreach ( System.Diagnostics.Process p in process)
{
p.Kill();
}