Windows 7 service monitoring an application
-
Friday, April 06, 2012 4:18 PMI amtrying to write a Windows service that will monitor a specific application running and if it stops then starts it up again. Any examples of such?
All Replies
-
Friday, April 06, 2012 5:10 PM
-
Friday, April 06, 2012 5:25 PMThank you Rupex! I need to figure out how to monitor an application is running and if not running then start it.
-
Friday, April 06, 2012 6:05 PM
Hi, enjoy this code:
Dim appMonitor = From p In System.Diagnostics.Process.GetProcessesByName("MyApp") Select p If appMonitor.Count = 0 Then ' Code here to restart the app End If
So above, you query the processes by name, if your app is not in the list the put some code in to start it again
- Edited by Dragan Radovac Friday, April 06, 2012 6:06 PM
- Marked As Answer by JimBassett Friday, April 06, 2012 8:18 PM
-
Friday, April 06, 2012 8:19 PMThank you Rupex. Marked as answered.

