请大家看看这段代码,急!!!!
Private Sub Killit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Killit.ClickListView1.Items.Clear()
Dim pTemp As System.Diagnostics.Process()
pTemp = System.Diagnostics.Process.GetProcesses()
Dim pTempProcess As New System.Diagnostics.Process
For Each pTempProcess In pTemp
Dim PName As New ListViewItem(pTempProcess.ProcessName)
Dim PID As New ListViewItem(pTempProcess.Id)
Dim PStartTime As New ListViewItem(pTempProcess.StartTime)
Dim PMemUse As New ListViewItem(pTempProcess.PrivateMemorySize64)
ListView1.Items.AddRange(New ListViewItem() {PName, PID, PStartTime})
Next
End Sub
这是一个按钮的点击事件,一个窗体,一个按钮,一个Listview控件,请高手看看,为何执行后,点击按钮,Listview闪了一下,就直接推出了?分不多,谢了。 --------------------编程问答--------------------
Dim PStartTime As New ListViewItem(pTempProcess.StartTime)有问题
Dim PStartTime As New ListViewItem(“aaa")先试试 --------------------编程问答-------------------- 这个倒可以,但楼主写的就拒绝访问.
Dim p As System.Diagnostics.Process = Process.GetCurrentProcess
MsgBox(p.StartTime.ToShortTimeString) --------------------编程问答-------------------- 对对对,就是拒绝访问,我再试试看! --------------------编程问答-------------------- 修改如下,为何还有问题?
Private Sub Killit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Killit.Click
ListView1.Items.Clear()
Dim pTemp As System.Diagnostics.Process() = Process.GetProcesses
For Each pTempProcess As System.Diagnostics.Process In pTemp
Dim PName As String = pTempProcess.ProcessName.ToString
Dim PStartTime As String = pTempProcess.StartTime.ToString
Dim PMemUse As String = pTempProcess.PrivateMemorySize64.ToString
Dim PID As String = pTempProcess.Id.ToString
Dim lvtTemp As ListViewItem = New ListViewItem(New String() {PName, PStartTime, PMemUse, PID})
ListView1.Items.Add(lvtTemp)
Next
End Sub
请高手再看看,麻烦说得详细些! --------------------编程问答-------------------- 自己再顶!!! --------------------编程问答-------------------- System Idle Process SYSTEM不是一个真正的进程,是核心虚拟出来的,多任务操作系统都有的! --------------------编程问答-------------------- 该回复被版主删除
补充:.NET技术 , VB.NET