1。获取进程Id,进程名字。
代码
using System.Diagnostics;
//获取电脑当前运行的进程
Process[] myProcesses;
//Get the list of current active processes.
myProcesses = System.Diagnostics.Process.GetProcesses();
//Grab some basic information for each process.
Process myProcess;
int pId;
string pName;
int pCount = myProcesses.Length;
for (int i = 0; i < pCount; i++)
{
myProcess = myProcesses[i];
pId = myProcess.Id;
pName = myProcess.ProcessName;
}
//获取电脑当前运行的进程
Process[] myProcesses;
//Get the list of current active processes.
myProcesses = System.Diagnostics.Process.GetProcesses();
//Grab some basic information for each process.
Process myProcess;
int pId;
string pName;
int pCount = myProcesses.Length;
for (int i = 0; i < pCount; i++)
{
myProcess = myProcesses[i];
pId = myProcess.Id;
pName = myProcess.ProcessName;
}