zoukankan
html css js c++ java
列出C#进程以及详细信息
结合着上一篇,再写一个获取进程详细信息的代码
建立一个listBox将进程名称遍历进去
this
.listBox1.Items.Clear();
Process[] MyProcesses
=
Process.GetProcesses();
foreach
(Process MyProcess
in
MyProcesses)
{
this
.listBox1.Items.Add(MyProcess.ProcessName);
}
this
.listBox1.SelectedIndex
=
0
;
选中listBox里面的项后将进程详细信息显示在右面的Label中
try
{
string
ProcessName
=
this
.listBox1.Text;
this
.groupBox1.Text
=
ProcessName
+
"
进程的详细信息
"
;
Process[] MyProcess
=
Process.GetProcessesByName(ProcessName);
this
.label1.Text
=
"
进程影象名:
"
+
MyProcess[
0
].ProcessName;
this
.label2.Text
=
"
进程ID:
"
+
MyProcess[
0
].Id;
this
.label3.Text
=
"
启动线程树:
"
+
MyProcess[
0
].Threads.Count.ToString();
this
.label4.Text
=
"
CPU占用时间:
"
+
MyProcess[
0
].TotalProcessorTime.ToString();
this
.label5.Text
=
"
线程优先级:
"
+
MyProcess[
0
].PriorityClass.ToString();
this
.label6.Text
=
"
启动时间:
"
+
MyProcess[
0
].StartTime.ToLongTimeString();
this
.label7.Text
=
"
专用内存:
"
+
(MyProcess[
0
].PrivateMemorySize
/
1024
).ToString()
+
"
K
"
;
this
.label8.Text
=
"
峰值虚拟内存:
"
+
(MyProcess[
0
].PeakVirtualMemorySize
/
1024
).ToString()
+
"
K
"
;
this
.label9.Text
=
"
峰值分页内存:
"
+
(MyProcess[
0
].PeakPagedMemorySize
/
1024
).ToString()
+
"
K
"
;
this
.label10.Text
=
"
分页系统内存:
"
+
(MyProcess[
0
].PagedSystemMemorySize
/
1024
).ToString()
+
"
K
"
;
this
.label11.Text
=
"
分页内存:
"
+
(MyProcess[
0
].PagedMemorySize
/
1024
).ToString()
+
"
K
"
;
this
.label12.Text
=
"
未分页系统内存:
"
+
(MyProcess[
0
].NonpagedSystemMemorySize
/
1024
).ToString()
+
"
K
"
;
this
.label13.Text
=
"
物理内存:
"
+
(MyProcess[
0
].WorkingSet
/
1024
).ToString()
+
"
K
"
;
this
.label14.Text
=
"
虚拟内存:
"
+
(MyProcess[
0
].VirtualMemorySize
/
1024
).ToString()
+
"
K
"
;
}
catch
(Exception Err)
{
MessageBox.Show(
"
没有此进程,无法获取信息!
"
,
"
信息提示
"
,MessageBoxButtons.OK,MessageBoxIcon.Information);
//
不处理异常
}
下载地址:
https://files.cnblogs.com/mgod/WindowsINI.rar
查看全文
相关阅读:
LINUX安装 RPM与YUM
ln s 软链接知识总结
JQuery EasyUI 之 combobox plugin
域名的DNS解析指南
Asp.NET + OWC 输出Chart(图表)
打败 IE 的葵花宝典:CSS Bug Table
Route命令使用详解
JQuery EasyUI 之 validatebox plugin
JQuery easyUI 之 datebox plugin
[转]如何安全的存储密码
原文地址:https://www.cnblogs.com/top5/p/1723609.html
最新文章
Linux的僵尸进程及其解决方法
Systemd
使用javaMail接收邮件(比较全)
signal(SIGPIPE,SIG_IGN)问题
open("/dev/null",o_rdwr)的问题
枚举
boost初探
寻找局部最小值
C++基础1
vim
热门文章
求最长上升子序列
Kotlin协程 协程的出现意味着什么?
Android Runtime 的简单了解
EXSI6.7 中给虚拟机磁盘扩容
全量备份/增量备份/差异备份
Centos8 下部署 ASP.net Core 程序
ubuntu 学习中的坑20211122
主域名解析设置
linux下更改文件字符格式为uft8
centos修改文件及文件夹权限
Copyright © 2011-2022 走看看