tags:

views:

561

answers:

1

I'm trying to build an application that needs to lock down access to the PC while it is running. I need to make the app run topmost, in full screen mode, and ensure that alt-tabbing doesn't allow access to other apps 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've tried to implement the LostFocus behaviour on the window, but that doesn't seem to give me the behaviour I need.

Can anyone point me in the direction I need to implement this behaviour, please?

Additional Info
Unfortunately, the nature of this project is such that we can't alter the client machines, and they are running a mix of XP, Vista and Win7. The PCs are not owned by us, but are to be used for delivery of content in as secure a manner as possible. The owners of the PCs are aware of the restrictions for running the software, and are happy for them to be "locked down" during execution of our application, but they cannot otherwise be altered.

Other ways
HakonB mentioned Scott Hanselman's BabySmash application, so I went looking for his way of handling the situation. As HakonB says, it isn't the cleanest method of handling lost focus, but it seems to work, or at least should do until I find a better solution. He uses a timer that fires every second, and fires off a call to user32.dll's SetForegroundWindow(IntPtr hWnd) method to grab focus, regardless of whether it has focus or not. Thanks for the heads-up, HakonB!

+2  A: 

Take a look at Scott Hanselman's BabySmash. You can find the site at BabySmash

He had a couple of blog entries describing his work to make the application. It features a baby-safe application in kiosk mode.

You can find the project on Codeplex

HakonB
I've had a look at BabySmash already, and haven't been able to infer from the code/XAML how he achieved hiding the taskbar in this way. I'll go re-read the blog posts, though, in the hope of enlightenment. Thanks.
ZombieSheep
He doesn't achieve it as cleanly as I would have liked it: He has a timer that fires once every second and in the timer event he makes sure that his main window is the foreground window. The logic is in the Controller.cs file. Btw, my son didn't break anything while smashing :-)
HakonB