扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:马金虎 来源:yesky 2007年10月15日
关键字:
Private Sub Button1_Click ( ByVal sender As System.Object , ByVal e As System.EventArgs ) Handles Button1.Click Dim lvcItem As ListView.SelectedListViewItemCollection = New ListView.SelectedListViewItemCollection ( ListView1 ) Dim sTemp As String = lvcItem ( 0 ) .SubItems ( 1 ) .Text Dim iTemp As Integer = Int32.Parse ( sTemp ) '根据ID号,得到要杀死的进程 Dim pProcessTemp As System.Diagnostics.Process = Process.GetProcessById ( iTemp ) Dim drTemp As DialogResult = MessageBox.Show ( "是否结束进程?" + pProcessTemp.ProcessName , "VB.NET打造Windows进程管理器!" , MessageBoxButtons.YesNo , MessageBoxIcon.Question ) Dim iDrTemp As Integer = Int32.Parse ( drTemp ) If iDrTemp = 6 Then ' 按动确定按钮 '杀死此进程 pProcessTemp.Kill ( ) pProcessTemp.Close ( ) End If End Sub |
Private Sub Form1_Load ( ByVal sender As System.Object , ByVal e As System.EventArgs ) Handles MyBase.Load ListView1.Items.Clear ( ) '创建一个Process类型的数组 Dim pTemp As System.Diagnostics.Process ( ) '通过此语句返回的是进程数组,这些进程数组存放的是当前运行存在地进程资源 pTemp = System.Diagnostics.Process.GetProcesses ( ) '得到当前运行进程数目 StatusBarPanel1.Text = "进程数:" + pTemp.Length.ToString ( ) '获取计算机中每一个进程的信息,并显示出来 Dim pTempProcess As System.Diagnostics.Process For Each pTempProcess In pTemp '得到进程的名称 Dim sProcessNeme As String = pTempProcess.ProcessName '得到进程的ID号 Dim sProcessID As String = pTempProcess.Id.ToString ( ) '得到进程的开始运行时间 Dim sStartTime As String = pTempProcess.StartTime.ToString ( ) '得到进程运行所需要的内存大小 Dim sMemroyUse As String = pTempProcess.PrivateMemorySize.ToString ( ) '显示获取的信息 Dim lvtTemp As ListViewItem = New ListViewItem ( New String ( ) {sProcessNeme , sProcessID , sStartTime , sMemroyUse} , -1 ) ListView1.Items.Add ( lvtTemp ) Next End Sub |
Private Sub MenuItem1_Click ( ByVal sender As System.Object , ByVal e As System.EventArgs ) Handles MenuItem1.Click Dim lvcItem As ListView.SelectedListViewItemCollection = New ListView.SelectedListViewItemCollection ( ListView1 ) Dim sTemp As String = lvcItem ( 0 ) .SubItems ( 1 ) .Text Dim iTemp As Integer = Int32.Parse ( sTemp ) '根据ID号,得到要杀死的进程 Dim pProcessTemp As System.Diagnostics.Process = Process.GetProcessById ( iTemp ) Dim drTemp As DialogResult = MessageBox.Show ( "是否结束进程?" + pProcessTemp.ProcessName , "VB.NET打造Windows进程管理器!" , MessageBoxButtons.YesNo , MessageBoxIcon.Question ) Dim iDrTemp As Integer = Int32.Parse ( drTemp ) If iDrTemp = 6 Then ' 按动确定按钮 '杀死此进程 pProcessTemp.Kill ( ) pProcessTemp.Close ( ) End If End Sub |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者