C#簡略讀取主機上一切過程的辦法。本站提示廣大學習愛好者:(C#簡略讀取主機上一切過程的辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是C#簡略讀取主機上一切過程的辦法正文
本文實例講述了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#法式設計有所贊助。