I want to allow my user to work with several predefined lists of applications for a certain time. I use the Windows C # service, which will run in the background and check the active window for a certain period of time to make sure that the active application is in the list of allowed applications.
I did my homework, and it seems to me that I need to capture the "window switch" event via SetWinEventHook() , and then call SwitchToThisWindow() or SetActiveWindow() to return in case a new window is not allowed.
But that does not work. I can still switch to other windows.
What am I doing wrong, or even if I use the right approach?
source share