| 网站首页 | VB.Net实例分析 | .Net技术文摘 | 下载中心 | VB.Net书籍笔记 | .Net源码 | VBS脚本与组件调用 | Windows2008技术文摘 | 给我们留言 | 
最新公告:

  没有公告

您现在的位置: 乐博网 >> VB.Net实例分析 >> 实例学习笔记 >> 实例分析正文
最新推荐 更多内容
进程管理(VB2010实例)
进程管理(VB2010实例)
作者:Akyao    来源:乐博网收集     更新时间:2011-4-5

进程管理(VB2010实例)

VB2010源代码如下:

' Copyright (c) Microsoft Corporation. All rights reserved.
Public Class MainForm

    Private Sub CurrentProcessInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCurrentProcessInfo.Click
        ' Shows how to retrieve information about the current Process.
        Dim curProc As Process = Process.GetCurrentProcess()

        Dim description As String = "The total working set of the current process is: " + _
                curProc.WorkingSet64.ToString() + vbCrLf

        description += "The minimum working set of the current process is: " + _
                curProc.MinWorkingSet.ToString() + vbCrLf

        description += "The max working set of the current process is: " + _
                curProc.MaxWorkingSet.ToString() + vbCrLf

        description += "The start time of the current process is: " + _
                curProc.StartTime.ToLongTimeString() + vbCrLf

        description += "The processor time used by the current process is: " + _
        curProc.TotalProcessorTime.ToString() + vbCrLf

        DisplayText.Text = description
    End Sub

    Private Sub btnStartProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartProcess.Click
        ' Simple Demonstration of starting a process using the process class.
        Process.Start("notepad.exe")
    End Sub

    Private Sub btnProcessStartInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcessStartInfo.Click
        ' The StartInfo object allows you to pass additional parameters to your application
        ' before starting it.  In this case the default window state of the application is set.
        Dim startInfo As New ProcessStartInfo("notepad.exe")
        startInfo.WindowStyle = ProcessWindowStyle.Maximized
        Process.Start(startInfo)
    End Sub

    Private Sub btnTaskManager_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTaskManager.Click
        ' Using the process class you can get access to additional information such as the
        ' modules loaded by a process.  The form shown by this code illustrates this.
        Dim manager As New TaskManager()
        manager.Show()
    End Sub

    Private Sub btnShellExecute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShellExecute.Click

        If Not System.IO.File.Exists("c:\乐博网.txt") Then
            Dim sw As New System.IO.StreamWriter("c:\乐博网.txt")
            sw.WriteLine("Shell Execute Demo")
            sw.Close()
        End If

        ' The StartInfo class can also be used to specify that you wish Operating System Shell
        ' to execute the process.  'This means that you can pass file names with extensions that
        ' are known by the operating system and the operating system will launch the appropriate
        ' application type.
        Dim startInfo As New ProcessStartInfo("c:\乐博网.txt")
        ' The default for UseShellExecute is false. If this is not set an exception would be
        ' thrown when the start method is executed.
        startInfo.UseShellExecute = True
        Process.Start(startInfo)

    End Sub

    Private Sub btnCommandLine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCommandLine.Click
        ' Starts Windows Explorer with two different command line arguments.
        Dim startInfo As New ProcessStartInfo("explorer.exe")
        ' Opens a new single-pane Window for the default selection.
        ' This is usually the root of the drive on which Windows is installed.
        startInfo.Arguments = "/n"
        Process.Start(startInfo)
    End Sub


    Private Sub exitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitToolStripMenuItem.Click
        Me.Close()
    End Sub
End Class

  • 上一篇:

  • 下一篇:
  • 【字体: 】【打印此文】【关闭窗口
      相关文章:(只显示最新16条)
    管理计算机电源状态的类(VB2010实例)
    Tablet PC 上可用的文本识别选项(VB2010实例)
    Tablet PC 2005 中对笔势的系统识别(VB2010实例)
    自定义数据控件(VB2010实例)
    Tablet PC 2005 的区分上下文功能(VB2010实例)
    响应数字化仪触笔背面的橡皮擦(VB2010实例)
    WMI编程实例(VB2010实例)
    系统服务管理实例(VB2010实例)
    显示进程组成模块(VB2010实例)
    任务管理器编程(VB2010实例)
    性能计数器编程(VB2010实例)
    消息队列MSMQListener(VB2010实例)
    消息队列MSMQClient(VB2010实例)
    写入事件日志(VB2010实例)
    读取事件日志(VB2010实例)
    创建和删除事件日志(VB2010实例)

    | 设为首页 | 加入收藏 | 联系站长 | | 友情链接 | 版权申明 |
    乐博网欢迎各种媒体转载我们的原创作品[转载请注明出处];我们鼓励更多VB.Net开发者一起加入研究与探讨;如发现文章访问错误、内容错误或版权疑问、内容有违相关法律(如涉及政治、色情、反动或散布虚假有害信息)等情况,请及时向我们举报,我们将及时纠正!
    联系邮箱:Shiny#vip.qq.com (#替换为@) QQ交流群: 40797788 [闽ICP备05014267号]