运行效果图

    部分代码如下:

   #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. Linux 环境变量和source命令 (转)

    可能是班门弄斧了,仅share给尚不知道的童鞋. 1.       问题的来源: 为什么我们编译Android代码时,需要输入:  source ./build/envsetup.sh  或者 . . ...

  2. dp状态压缩-铺砖问题

    题目:有一个n行m列的地板,需要用 1*2小砖铺盖,小砖之间互相不能重叠,问有多少种不同的铺法? 示范: 解法:用F[i][j]存放第i行的第j状态(j为十进制,转为二进制即是状态)有多少种方案. 用 ...

  3. HBase源代码分析

    http://www.docin.com/p-647062205.html http://blog.csdn.net/luyee2010/article/category/1285622 http:/ ...

  4. SD和SDHC和SDXC卡的区别是什么

    SD卡,SDHC卡,SDXC卡区别在规格不一样,SD卡最大支持2GB容量,SDHC 最大支持32GB容量,SDXC 最大支持2TB(2048GB)容量,支持SDXC卡的数码设备是兼容支持SD卡与SDH ...

  5. Android 保存图片到SQLite,读出SQLite中的图片

    1.bitmap保存到SQLite 中 数据格式: db.execSQL("Create table express ( _id INTEGER PRIMARY KEY AUTOINCREM ...

  6. 深入Blocks分析

    1.简介 从iOS4开始,苹果引入了这个C语言的扩充功能"Blocks",在一些特定的场景下也是一把利刃.我前面一篇博客中初步介绍了Blocks这个东西,主要是语法的介绍(< ...

  7. poj1651 最优矩阵乘法动态规划解题

    题目描述: 有若干个矩阵{Ai},元素都为整数且已知矩阵大小. 如果要计算所有矩阵的乘积A1 * A2 * A3 .. Am,最少要多少次整数乘法? 输入 第一行一个整数n(n <= 100), ...

  8. 面向对象程序设计-C++_课时14对象组合_课时15继承

    对象组合,就是一个类的对象作为另外一个类的成员,涉及类的对象,对象是实体,玩实 继承,涉及类,类是概念,玩虚 public: 所有人都可以接触 private: 数据放private protecte ...

  9. UI_拖动View

    方法一 在touchesMoved中 // 获取到触摸的手指 UITouch *touch = [touches anyObject]; // 获取集合中对象 // 获取開始时的触摸点 CGPoint ...

  10. Ubuntu 14.04安装地里编码软件Nominatim过程

    一.必须软件: 在Ubuntu系统编译执行Nominatim软件系统必须安装的软件有: 1.GCC 编译器 2.postgresql 数据库 3.proj4 4.geos 5.postgis 6.PH ...