Here is, basically, how my application works:
When windows starts, my app starts. Whenever my app is running, it hides the desktop, taskbar, etc... When a button is clicked in my application ("Start program"), then my application will set its visible property at false and another application will start.
Everything seems to work perfect except I need a way for my application to set its visible property back to true, but only once the other application that was started earlier, is closed (no longer running.)
My thought was that I could use a timer to check for the applications state every so many seconds:
Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("vk")
For Each p As Process In pProcess
'do nothing, else set visibility to true
Next
I have 2 concerns with this:
1. A timer checking this every few seconds will invoke unneeded stress on a computer since they are running for sometimes very long periods of time.
2. There is a better way to accomplish this that doesnt rely on a timer.
Please let me know if you have any ideas, I am stumped over here!
Thanks!