请问各位,如何判断某个进程是否打开?例如,现在你的机器是否运行着QQ?
如题!
谢谢!
------解决方案--------------------用System.Diagnostics.Process.GetProcessesByName,System.Diagnostics.Process.GetProcessById试试
------解决方案--------------------Process.GetProcesses()获得全部process实例
------解决方案--------------------Process[] process = Process.GetProcesses();
foreach(Process p in process)
{
this.label1.Text += p.ProcessName + "\n " ;
}
------解决方案--------------------foreach (Process oth in Process.GetProcesses())
{
//this.richTextBox1.AppendText(oth.ProcessName+ "\n ");
if (oth.ProcessName.ToUpper() == "QQ ")
{
this.richTextBox1.AppendText(oth.ProcessName + "\n ");
this.richTextBox1.AppendText(oth.Id.ToString()+ "\n ");
}
}