简体   繁体   中英

Prevent user from switching to other windows

I want to allow my user to work with only a few predefined list of applications during a certain time. I'm using a C# Windows Service that will run in the background and check the active window during a specific time period to verify that the active application is in the list of allowed apps.

I have done some homework and it looks like I need to capture " window switch " event through SetWinEventHook() and then call SwitchToThisWindow() or SetActiveWindow() to switch back in case the new window is not allowed.

But this doesn't really work. I'm still able to switch to other windows.

What am I doing wrong, or even if I'm taking the correct approach?

Is this to build a custom application machine and/or a web kiosk type system? You might want to look at Windows XP Embedded where you can remove the explorer and the ability to run any apps other than what you want. It's specifically designed for the scenario you are describing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM