我想写一个程序,专门监控某一个进程是否停止响应,如果停止响应就杀死该进程;还要监控CPU的占用率、内存使用了多少。请问各路大侠如何实现?

解决方案 »

  1.   


    'Project---〉Components--〉选择System Monitor Control (Sysmon.ocx)控件,确定后将控件
    'SystemMonitor拖放到Form上。
    'SystemMonitor1.BrowseCounters可以弹出其自带的属性定义窗体
    '当然你也可以往Counters中添加CounterItem,如下所示仅仅是添加了
    'Processor Time和内存两项指标,Add的参数参照BrowseCounters打开的那个属性框吧
    '其实所有的参数均可以定制,如果你不想要他所有界面你也可以将所有界面重写Option ExplicitPrivate Sub Command1_Click()
        'SystemMonitor1.BrowseCounters
        SystemMonitor1.Counters.Add "\Processor(0)\% Processor Time"
        SystemMonitor1.Counters.Add "\Memory\Pages/sec"
    End Sub