I have a Windows service that should run for all users that needs to know which user is currently logged in. I'd like to write an app that gets started when a user logs in that will alert the service that that user is the one that's currently logged in. It would also need to handle when the user is switched (meaning both are still running).
Is this possible and the best way of keeping my service aware of what user is currently logged in and using the computer, and if so, how might I go about creating/installing my app so that it starts when the user logs in (does it just go in the Startup folder for that user?) and determining if users were switched?
If not, what is the best way to do this?