看相关的
资料,就可以知道这个应用程序的基本编程思路,这个功能对
程序员很有用。
了解了基本知识,现在就就可以编程了。首先建立一个窗口,在窗口上加上一个TabControl分页控件,在第一页加上label1,label2,listbox1,listbox2,button1。在第二页上加上label4,label6,listbox3,listbox4,在第三页上加上label5,label7,listbox5,listbox6。将所有的listbox控件的HorizontalScrollbar属性设置为true
然后添加如下代码(
vb.net编写)
Public Class Form1
Inherits System.Windows.Forms.Form
Public zj
Public myProcesses() As Process
Public myProcess As Process
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Clear()
myProcesses = Process.GetProcesses()
For Each myProcess In myProcesses
ListBox1.Items.Add(myProcess.ProcessName)
Next
Label1.Text = ""
Label1.Text = "本机共有" & ListBox1.Items.Count & "个进程在运行"
End Sub
Private Sub ListBox1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
Dim i : Dim f As Integer : Dim h As Integer
ListBox2.Items.Clear()
zj = ListBox1.SelectedIndex
Label2.Text = "进程" & ListBox1.Items.Item(zj) & "的相关信息"
With ListBox2.Items
If myProcesses(zj).MainWindowTitle = "" Then
.Add("无相关主窗口")
Else
.Add(myProcesses(zj).MainWindowTitle)
End If
.Add(myProcesses(zj).BasePriority & "进程的基本优先级")
.Add(myProcesses(zj).Handle.ToString & "进程的本机句柄")
.Add(myProcesses(zj).HandleCount & "进程打开的句柄数")
.Add(myProcesses(zj).Id & "进程的唯一标识符")
.Add(myProcesses(zj).MachineName & "进程正在其上运行的
计算机的名称")
.Add(myProcesses(zj).MainModule.ToString & "进程的主模块")
.Add(myProcesses(zj).MainWindowHandle.ToString & "进程主窗口的句柄")
''.Add(myProcesses(zj).Modules & "")
.Add(myProcesses(zj).NonpagedSystemMemorySize & "分配给此进程的未分页的系统内存大小")
.Add(myProcesses(zj).PagedMemorySize & "分页的内存大小")
.Add(myProcesses(zj).PagedSystemMemorySize & "分页的系统内存大小")
.Add(myProcesses(zj).PeakPagedMemorySize & "峰值分页内存大小")
.Add(myProcesses(zj).PeakVirtualMemorySize & "峰值虚拟内存大小")
.Add(myProcesses(zj).PrivateMemorySize & "专用内存大小")
.Add(myProcesses(zj).StartTime & "进程启动的时间")
.Add(myProcesses(zj).TotalProcessorTime.Seconds & "进程的总的处理器时间")
.Add(myProcesses(zj).UserProcessorTime.Seconds & "进程的用户处理器时间")
.Add(myProcesses(zj).VirtualMemorySize & "进程的虚拟内存大小")
End With
&