Reputation: 37
Basically I have my "monitor" and I'm playing and the executable is "Game.exe" (Rpg Maker xp). I want my "monitor" to close itself after Game.exe is killed or terminated. If I can, how should I do this properly? Sorry horrible english
Upvotes: 2
Views: 151
Reputation: 172210
You can use Process.GetProcessesByName
to find out whether your "target process" is still running:
Dim gameStillRunning = Process.GetProcessesByName("Game").Any()
How to trigger the end of your own application depends on the nature of your monitoring application:
If it's a GUI application, set a timer that frequently checks if Game is still running.
If your application has no other purpose than to wait until Game has been closed (or if you have a dedicated thread for this purpose), you can use p.WaitForExit()
on the process p
obtained by GetProcessesByName
.
Upvotes: 1