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
查看全文
相关阅读:
Could not obtain transaction-synchronized Session for current thread
Spring 具名参数NamedParameterJdbcTemplate
Could not load driverClass jdbc:mysql://localhost:3306/spring
Spring 使用AspectJ的三种方式
Excel 若某列包含某个字符则特定列显示特定字符
使用Spring的隐式注解和装配以及使用SpringTest框架
Eclipse Oxygen 解决 自动导包的问题
C3P0 WARN: Establishing SSL connection without server's identity verification is not recommended
Eclipse 多行复制并且移动失效
正则表达式 使用代码
原文地址:https://www.cnblogs.com/top5/p/1723609.html
最新文章
SQL Server Reporting Service(SSRS) 第五篇 自定义数据处理扩展DPE(Data Processing Extension)
SQL Server Reporting Service(SSRS) 第四篇 SSRS 常见问题总结
SQL Server Reporting Service(SSRS) 第三篇 SSRS Matrix用法
SQL Server Reporting Service(SSRS) 第二篇 SSRS数据分组Parent Group
我的英语提升计划----第一篇
软件开发心得体会--如何突破工作中遇到的技术问题
SQL Server Reporting Service(SSRS) 第一篇 我的第一个SSRS例子
Dev Express Report 学习总结(四)Dev Express 动态生成XRTable使用总结
C# 基础知识总结
C++踩过的坑
热门文章
http协议笔记
TCP协议复习
linux常用命令总结
std::string中data()和c_str()的区别
gossip协议
go字符串操作
拓扑排序
布隆过滤器
libmicrohttpd库
java.lang.NoClassDefFoundError: org/apache/jsp/Index_jsp
Copyright © 2011-2022 走看看