运行效果图

    部分代码如下:

   #region  打开应用程序按钮事件处理程序
/// <summary>
/// 打开应用程序按钮事件处理程序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void open_Click(object sender, EventArgs e)
{
OpenFileDialog fd = new OpenFileDialog();
fd.FileName = "";
fd.Filter = "应用程序(*.exe)|*.exe";
fd.ShowDialog();
if(fd.FileName!="")
{
//设置启动的信息
ProcessStartInfo ps = new ProcessStartInfo(fd.FileName);
temp = new Process();
temp.StartInfo = ps;
temp.Start();
Thread.Sleep();
FreshDataGriedView();
}
}
#endregion #region 刷新进程表方法
/// <summary>
/// 刷新进程表
/// </summary>
private void FreshDataGriedView() {
Process[] _temp = Process.GetProcesses();
dataGridView1.Rows.Clear();
foreach(Process temp in _temp){
int newRowIndex = dataGridView1.Rows.Add();
DataGridViewRow newRow = dataGridView1.Rows[newRowIndex];
newRow.Cells[].Value=temp.Id;
newRow.Cells[].Value=temp.ProcessName;
newRow.Cells[].Value=string.Format("{0:###,##0.00}",temp.WorkingSet64/1024.0f/1024.0f);
try{
newRow.Cells[].Value=string.Format("{0}",temp.StartTime);
newRow.Cells[].Value=temp.MainModule.FileName;
}
catch{
newRow.Cells[].Value="";
newRow.Cells[].Value="";
}
} }
#endregion #region 刷新按钮的事件处理
/// <summary>
/// 刷新按钮的事件处理
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void fresh_but_Click(object sender, EventArgs e)
{
FreshDataGriedView();
}
#endregion #region 关闭进程按钮事件处理程序
/// <summary>
/// 关闭进程按钮事件处理程序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
//label1.Text = process_selceted_id.ToString();
try
{
//temp.Dispose();
temp.CloseMainWindow();
FreshDataGriedView();
}
catch
{
MessageBox.Show("请选中一个进程","错误提示",MessageBoxButtons.OK);
}
}
#endregion
//行选中的事件
private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
try
{
//label1.Text = e.RowIndex.ToString() + "--" + dataGridView1.Rows[e.RowIndex].Cells[0].Value;
process_selceted_id = Convert.ToInt16(dataGridView1.Rows[e.RowIndex].Cells[].Value);
temp = Process.GetProcessById(process_selceted_id);
textbox_apand(); }
catch { }
}
//显示进程信息
private void textbox_apand() {
StringBuilder stringText = new StringBuilder();
stringText.AppendLine("进程ID:" + temp.Id);
stringText.AppendLine("进程ID:"+temp.ProcessName);
try
{
stringText.AppendLine();
ProcessModule m = temp.MainModule;
stringText.AppendLine("文件名:"+m.FileName);
stringText.AppendLine("版 本:"+m.FileVersionInfo.FileVersion);
stringText.AppendLine("描 述:"+m.FileVersionInfo.FileDescription);
stringText.AppendLine("语 言:"+m.FileVersionInfo.Language); }
catch{
stringText.AppendLine("无法获取信息");
}
this.textBox1.Text = stringText.ToString();
}

C#进程管理程序实现的更多相关文章

  1. linux----------安装Supervisor是用Python开发的一套通用的进程管理程序

    1.linux环境必须安装 python 2.yum install python-setuptools 3.获取supervisor包 wget https://pypi.python.org/pa ...

  2. 进程管理supervisor的简单说明

    背景: 项目中遇到有些脚本需要通过后台进程运行,保证不被异常中断,之前都是通过nohup.&.screen来实现,带着能否做一个start/stop/restart/reload的服务启动的想 ...

  3. 进程管理工具Supervisor(一)简介与使用

    Supervisor是用Python开发的一套client/server架构的进程管理程序,能做到开机启动,以daemon进程的方式运行程序,并可以监控进程状态等等. linux进程管理方式有传统的r ...

  4. Linux进程管理工具Supervisor

    简述 Supervisor是用Python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时能自动重启. 它是通过fork/exec的方式把这些被管 ...

  5. supervisor进程管理的使用

    介绍 Supervisor是用Python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时能自动重启.它是通过fork/exec的方式把这些被管理 ...

  6. supervisor 管理uwsgi 进程

    Supervisor是用Python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时能自动 重启.它是通过fork/exec的方式把这些被管理的进 ...

  7. 守护进程与Supervisor

    博客链接:http://www.cnblogs.com/zhenghongxin/p/8676565.html 消息队列处理后台任务带来的问题 在系统稍微大些的时候,我们经常会用到消息队列(实现的方式 ...

  8. linux学习(四) -- supervisor守护进程

      supervisor是用Python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时能自动重启.   1.安装 apt-get install ...

  9. 详解Supervisor进程守护监控

    Supervisor在百度百科上给的定义是超级用户,监管员.Supervisor是一个进程管理工具,当进程中断的时候Supervisor能自动重新启动它.可以运行在各种类unix的机器上,superv ...

随机推荐

  1. ResultSet与Result

    微软的.NET平台上面的数据访问有一个特点,就是数据查询的结果,可以放在内存中,以XML格式进行描述,不需要一直与数据库保持在线连接,用DataSet + Data Adapter来实现! 而在JDB ...

  2. 相见恨晚——MarkDown

    什么是MarkDown MarkDown是一种轻量级的标记语言 MarkDown使你更加关注文章的内容 MarkDown使文章的排版变得简单直接 什么情景下使用MarkDown 在我们熟悉的githu ...

  3. nginx+php-fpm json_encode 到client pages 截断

    同样的数据rd环境is normal, but in test environment the result of json had been intercepted 稳定定位: nginx指定的磁盘 ...

  4. Android Spinner 下拉列表

    private Spinner spinner ;         private List<String> list ;         private ArrayAdapter< ...

  5. this指针与function变量--this究竟指向哪里?

    参考文章:<深入浅出 JavaScript 中的 this> http://www.ibm.com/developerworks/cn/web/1207_wangqf_jsthis/ Ja ...

  6. NOI2012 Day2

    NOI2012 Day2 迷失游乐园 题目描述:给出一个\(n\)个点的图,边数为\(n-1\)或\(n\).从某个点出发,每次等概率地随机选一个相连的并且没有经过过的点,直到不能走为止,问期望路径长 ...

  7. append与after区别

    append() & prepend()实在元素内插入内容(该内容变成该元素的子元素或节点),after() & before()是在元素的外面插入内容(其内容变成元素的兄弟节点).

  8. Largest Submatrix(动态规划)

    Largest Submatrix Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  9. android基础5——使用资源

    Android会基于当前的硬件.设备和语言配置来为某个资源标识符选择最合适的值. 1.在代码中使用资源 使用静态类R来访问资源.R类是基于外部资源而生的类,并且是在项目编译的时候创建的.R的每一个子类 ...

  10. 【leetcode边做边学】二分查找应用

    很多其它请关注我的HEXO博客:http://jasonding1354.github.io/ 简书主页:http://www.jianshu.com/users/2bd9b48f6ea8/lates ...