代碼如下:

代碼
#region 取得windows的所有程序
public static string GetCourse()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
string tempName = "";
int begpos, endpos;
foreach (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

本文轉自王磊的部落格部落格園部落格,原文連結:http://www.cnblogs.com/vipstone/archive/2010/11/23/1885387.html,如需轉載請自行聯系原作者