运行效果图

    部分代码如下:

   #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. PLSQL笔记

    /*procedurallanguage/sql*/--1.过程.函数.触发器是pl/sql编写的--2.过程.函数.触发器是在oracle中的--3.pl/sql是非常强大的数据库过程语言--4.过 ...

  2. 第四课 Grid Control实验 GC Agent安装(第一台机器部署) 及卸载

    3.GC Agent安装(第一台机器部署) 安装Agent 拷贝agent,现在ocm2机器上查找agent.linux  查找文件的方法: find ./ -name agent*linux 把ag ...

  3. iOS百度推送的基本使用

    一.iOS证书指导 在 iOS App 中加入消息推送功能时,必须要在 Apple 的开发者中心网站上申请推送证书,每一个 App 需要申请两个证书,一个在开发测试环境下使用,另一个用于上线到 App ...

  4. light oj 1027 A Dangerous Maze

    一道数学期望题,唉唉,概率论学的不好啊~~ 求走出迷宫的期望时间. 由于有的门会回到起点,所以有可能会走很多遍,设能走出去的门的个数为n1,总的个数为n,那么一次走出去的概率为n1/n,走一次的用的平 ...

  5. Linux学习之wget命令

    Linux系统中的wget是一个下载文件的工具,它用在命令行下.对于Linux用户是必不可少的工具,我们经常要下载一些软件或从远程服务器恢复备份到本地服务器.wget支持HTTP,HTTPS和FTP协 ...

  6. 如何设置MySQL数据库名、表名大小写敏感

    在 MySQL 中,数据库和表其实就是数据目录下的目录和文. 因而,操作系统的敏感性决定数据库和表命名的大小写敏感.这就意味着数据库和表名在 Windows 中是大小写不敏感的,而在大多数类型的 Un ...

  7. Android 监听器

    Android提供很多种事件监听器,监听器主要是为了相应某个动作,可以通过监控这种动作行为,来完成我们需要的程序功能.      OnItemClickListener:               ...

  8. JS中String添加trim()方法

    这么牛的JS竟然还要自己封装trim方法. 下面利用prototype和正则表达式的添加方式添加trim(): <script language="javascript"&g ...

  9. JS知识点摘记(一)

    JavaScript:基于对象和事件的脚本语言 特点: 安全性:不允许直接访问本地硬盘,可做的就是信息的动态交互 跨平台性:只要可以解析JS的浏览器就可执行,与平台无关 JavaScript与Java ...

  10. Bash debug

    Debugging bash scripts Bash can help us to find problems in bash scripts in some ways. You don't exp ...