2 problems with your "dumbass" program

1. Polling too often
If your application polls every say 5 seconds then you will significantly slow down your entire system by constantly asking it what is currently running.

2. Polling too late
You could switch to an application and then switch to another before it got a time to "remember" where you were.



But if you know how to do that... why haven't you tried??!?!