首页 > 编程 > C# > 正文

C#简单读取主机上所有进程的方法

2019-10-29 21:23:26
字体:
来源:转载
供稿:网友

本文实例讲述了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#程序设计有所帮助。



注:相关教程知识阅读请移步到c#教程频道。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表