本文實例講述了C#簡單讀取主機上所有進程的方法。分享給大家供大家參考,具體如下:
#region 取得windows的所有進程public static string GetCourse(){  System.Text.StringBuilder sb = new System.Text.StringBuilder();  string tempName = "";  int begpos, endpos;  foreach (System.Diagnostics.Process thisProc in System.Diagnostics.Process.GetProcesses())  {    tempName = thisProc.ToString();    begpos = tempName.IndexOf("(") + 1;    endpos = tempName.IndexOf(")");    tempName = tempName.Substring(begpos, endpos - begpos);    sb.Append(tempName + "<br /> ");  }  return sb.ToString();}#endregion希望本文所述對大家C#程序設計有所幫助。
| 
 
 | 
新聞熱點
疑難解答