C#进程管理程序实现
运行效果图

部分代码如下:
#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#进程管理程序实现的更多相关文章
- linux----------安装Supervisor是用Python开发的一套通用的进程管理程序
1.linux环境必须安装 python 2.yum install python-setuptools 3.获取supervisor包 wget https://pypi.python.org/pa ...
- 进程管理supervisor的简单说明
背景: 项目中遇到有些脚本需要通过后台进程运行,保证不被异常中断,之前都是通过nohup.&.screen来实现,带着能否做一个start/stop/restart/reload的服务启动的想 ...
- 进程管理工具Supervisor(一)简介与使用
Supervisor是用Python开发的一套client/server架构的进程管理程序,能做到开机启动,以daemon进程的方式运行程序,并可以监控进程状态等等. linux进程管理方式有传统的r ...
- Linux进程管理工具Supervisor
简述 Supervisor是用Python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时能自动重启. 它是通过fork/exec的方式把这些被管 ...
- supervisor进程管理的使用
介绍 Supervisor是用Python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时能自动重启.它是通过fork/exec的方式把这些被管理 ...
- supervisor 管理uwsgi 进程
Supervisor是用Python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时能自动 重启.它是通过fork/exec的方式把这些被管理的进 ...
- 守护进程与Supervisor
博客链接:http://www.cnblogs.com/zhenghongxin/p/8676565.html 消息队列处理后台任务带来的问题 在系统稍微大些的时候,我们经常会用到消息队列(实现的方式 ...
- linux学习(四) -- supervisor守护进程
supervisor是用Python开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时能自动重启. 1.安装 apt-get install ...
- 详解Supervisor进程守护监控
Supervisor在百度百科上给的定义是超级用户,监管员.Supervisor是一个进程管理工具,当进程中断的时候Supervisor能自动重新启动它.可以运行在各种类unix的机器上,superv ...
随机推荐
- 【转】使用Navicat for Oracle新建表空间、用户及权限赋予
首先.我们来新建一个表空间.打开Navicat for Oracle,输入相关的的连接信息.如下图: 填入正确的信息,连接后.我们点击面板上的“其他”下的选项“表空间”,如下图: 进入表空间的界面,我 ...
- Linux 环境变量和source命令 (转)
可能是班门弄斧了,仅share给尚不知道的童鞋. 1. 问题的来源: 为什么我们编译Android代码时,需要输入: source ./build/envsetup.sh 或者 . . ...
- 节点与坐标系——Cocos2d-x学习历程(十)
1.Node Cocos2d-x把渲染树上的每一个游戏元素抽象为一个节点,即Node.一切游戏元素都继承自Node,因此它们都具有Node所提供的特性.Node定义了一个可绘制对象的通用特性,包括位置 ...
- cookie程序设计举例
编写Cookie应用程序,一般流程是:首先尝试获取某个Cookie变量,如果有,则表明是老客户,读取其cookie信息,为其提供服务. 如果没有,则表明是第一次来访的客户,通过表单提交获取其身份信息, ...
- CentOS下Mysql安装调试
一.安装 yum安装:yum install -y mysql-server mysql mysql-devel 设置自启动:chkconfig mysqld on 启动MySQL:service ...
- MCS-51系统中断优先级的软扩展
摘要:鉴于MCS-51系统只提供“二级中断嵌套”,提出扩展51系统中断优先级的纯软件方法.其利用51系统内建的中断允许寄存器IE和中断优先级寄存器IP,通过屏蔽字机制来实现:以C51的形式,给出这种扩 ...
- billing是如何的拆分的?
在SD模块中,我们经常会考虑Billing分拆,分拆的标准如下: 一.根据Billing的字段项目进行分拆 在sap的标准系统中,系统会比较VBRK表的所有字段(也包含复制拆分组合标准字段ZUKRI) ...
- docker exec 运行命令
docker:/root/sbin# docker exec -it 17aaf60ee3a1 /sbin/ifconfig -a eth1 Link encap:Ethernet HWaddr 22 ...
- POJ1185 炮兵阵地 状态压缩
因为不知道不同的博客怎么转,就把别人的复制过来了,这个题解写的非常好,原地址为: http://hi.baidu.com/wangxustf/item/9138f80ce2292b8903ce1bc7 ...
- #include <array>
array是静态数组,在栈上,不可以变长 vector比array更常用 不需要变长,容量较小,用array 需要变长,容量较大,用vector 1 array 1 array新数组 //std::a ...