获取进程信息

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;                           
            }           

 

 

posted @ 2010-07-30 14:25  ike_li  阅读(190)  评论(0编辑  收藏  举报