- Rongsen.Com.Cn 版权所有 2008-2010 京ICP备08007000号 京公海网安备11010802026356号 朝阳网安编号:110105199号
- 北京黑客防线网安工作室-黑客防线网安服务器维护基地为您提供专业的服务器维护,企业网站维护,网站维护服务
- (建议采用1024×768分辨率,以达到最佳视觉效果) Powered by 黑客防线网安 ©2009-2010 www.rongsen.com.cn
 
  
    
| 作者:黑客防线网安C/C++教程基地 来源:黑客防线网安C/C++教程基地 浏览次数:0 | 
     建立一个listBox将进程名称遍历进去
undefined
undefined
 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中
undefined
undefined
 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);
 //
 不处理异常
 
}
| 我要申请本站:N点 | 黑客防线官网 | | 
| 专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479 |