"Kiosk Mode" in Windows 8.x
Saturday, June 13, 2015 at 02:41PM
Carl Franklin

This little snippet of code came from a real project I worked on. The customer wanted a touch-screen Kiosk. We had to use Windows 8.1 due to hardware requirements. I was able to make a great WPF UX using touch and make it full screen with no borders, and always on top.

In your <Window> Xaml object set these properties: 

 WindowStyle="None" WindowState="Maximized" Topmost="True" ResizeMode="NoResize"

That only got me so far. That pesky right-swipe charm is always there, and there's seemingly no way to get around it.

Turns out all that charm stuff is in explorer.exe, the Windows Explorer. That's the shell that lets you run all your apps. It contains all the taskbar, and gives you all the swipy gestures, corner hot spots, and all that. All you need to do is kill it. 

Also turns out that if you don't kill it properly it will come back with a vengence. So, I discovered this little trick using a ProcessStartInfo object. I call this in the MainWindow_Loaded event and all is well.

If you ever want to restart Explorer after running this app, you can press Ctrl-Alt-Del, bring up the Task Manager and run explorer from File -> Run new task -> "explorer.exe"

Be careful, and enjoy!

        void KillExplorer()
        {
            // Create a ProcessStartInfo, otherwise Explorer comes back to haunt you.
            ProcessStartInfo TaskKillPSI = new ProcessStartInfo("taskkill", "/F /IM explorer.exe");
            // Don't show a window
            TaskKillPSI.WindowStyle = ProcessWindowStyle.Hidden;
            // Create and start the process, then wait for it to exit.
            Process process = new Process();
            process.StartInfo = TaskKillPSI;
            process.Start();
            process.WaitForExit();
        }

 

 

Article originally appeared on Carl Franklin (http://carlfranklin.net/).
See website for complete article licensing information.