I need to write a monitoring/watchdog program to check a series of application
The monitoring program should be able to
What sort of API in VB.NET can help me achieve this?
any code sample would be very helpful
You can use System.Diagnostics.Process to start/find the processes you're watching. Depending on the apps you're watching, you can use something like this:
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
Determining if an application is "hung" is not always clear. It may just be busy doing something. Also Process.Responding requires a MainWindow.
That's a very simple example, but I hope it points you in the right direction.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With