Den*_*nis 5 vb.net monitoring watchdog hang
我需要编写一个监视/监视程序来检查一系列应用程序
监测计划应该能够
VB.NET中的哪种API可以帮助我实现这一目标?
任何代码示例都会非常有用
您可以使用System.Diagnostics.Process来启动/查找您正在观看的进程.根据您正在观看的应用,您可以使用以下内容:
For Each proc As Process In System.Diagnostics.Process.GetProcesses
If proc.ProcessName = "notepad" Then
If proc.Responding = False Then
' attempt to kill the process
proc.Kill()
' try to start it again
System.Diagnostics.Process.Start(proc.StartInfo)
End If
End If
Next
Run Code Online (Sandbox Code Playgroud)
确定应用程序是否"挂起"并不总是很清楚.它可能只是忙着做某事.Process.Responding还需要一个MainWindow.
这是一个非常简单的例子,但我希望它能指出你正确的方向.
| 归档时间: |
|
| 查看次数: |
7291 次 |
| 最近记录: |