I am trying to create an application that should block access to a PC while it is running. I need the application to run at the top of the screen in full screen mode and ensure that alt-tabbing does not allow access to other applications or the taskbar.
So far, I have set TopMost = true, WindowStyle = WindowStyle.None and WindowState = WindowState.Maximized, which achieves most of what I need, but I still get instances where the taskbar becomes visible. I tried to implement the LostFocus behavior in a window, but that doesn't seem like what I need.
Can someone point me in which direction I need to implement this behavior?
Additional information
Unfortunately, the nature of this project is such that we cannot change the client machines, and they use a combination of XP, Vista and Win7. PCs do not belong to us, but should be used to deliver content as securely as possible. PC owners are aware of the restrictions on launching the software and are glad that they were “blocked” during the execution of our application, but they cannot be changed otherwise.
Other ways
HakonB mentioned the Scott Hanselman BabySmash app, so I went looking for a way to handle the situation. According to HakonB, this is not the cleanest method of handling lost focus, but it seems to work or at least should do until I find a better solution. It uses a timer that fires every second, and launches a call to the user32.dll SetForegroundWindow (IntPtr hWnd) method to capture focus, regardless of whether it has focus or not. Thanks for the heads-up, HakonB!
source
share