Kiosk Mode for CE 6.0

Last August I put up a blog post that showed how to create a Kiosk type device using CE 5.0 and I've had a number of requests to update the blog post to cover CE 6.0 - so here's the CE 6.0 Kiosk mode post.

First thing to cover is what is Kiosk Mode ? - Kiosk mode can be thought of as an operating system image that boots into a custom application that only gives the user the ability to do one specific task, examples are an ATM machine, Airport Check in Terminal, that kinds of thing.

The CE 6.0 operating system has a number of shells that ship with the devleopment tools, these include:

  • "Standard Shell" (start button, task bar, icons on the desktop)
  • Command Shell (boots directly to a command prompt)
  • Thin Client Shell (for Remote Desktop/Thin Client devices)

Here's the shell components exposed in the CE 6.0 catalog.


You may have noticed that the design templates in CE 6.0 add one of the shells, typically the Standard Shell, for our Kiosk mode device we will need to do a number of things...

  1. Create an operating system that doesn't have a shell
  2. Create our shell application
  3. Create a "launcher" for the shell application
  4. Integrate everything into the final operating system image.

Let's get started...

Step 1 - Create an operating system that doesn't have a shell.

This is super easy - for this exercise I'm going to build an operating system based on the ARM Device Emulator, you can of course modify the settings to deploy to whatever your favorite device is.

Use Visual Studio 2005 (with all the appropriate service packs installed) and the CE 6.0 development tool installed to create a CE 6.0 Operating System Design, I'm using the Device Emulator, and will be building a Release image of the operating system, the intent here is not to debug the o/s image but simply to show the steps needed to build a custom o/s image that boots a custom/kiosk shell.

I'm going to base my operating system image on the Industrial Device configuration and the sub-category of Internet Appliance.

For this exercise I will accept all of the default options for the OS Design Wizard - I will use a Compact Framework application as the shell for the device (you could just as easily build a Win32/C/C++/MFC application - the steps would be pretty much the same).

Notice that the default OS Design generated operating system image is going to be a Debug Build, so we will need to switch this from Debug to Release (just use the combo box on the buid toolbar in Platform Builder).


The Internet Appliance configuration if built and booted would give us the Standard Shell (start button etc...), so we need to remove that - notice the Standard Shell and the Windows Thin Client Shell are both displayed with Radio buttons, this gives the impression that you need to have one or the other - in reality you can also not select any shell.


Let's build and boot the operating system and see what we get... Here's the device emulator with the final booted CE 6.0 operating system image - where's the user interface? - simple, there isn't one, we've removed the shell so there isn't any user interface or application running at boot time (although, if we were to use Platform Builder we could see that there are a number of processes running in the background).


Step 1 is complete - build and boot a custom operating system without a shell - next step is to write a shell application for our device - this is also very simple (although you can make it as complex as you like).

2. Create the Shell application.

I've decided that my shell application will be a .NET Compact Framework 2.0, C# application, that has a single button which, when clicked displays an appropriate message in a TextBox - yes, I know this is so simple that a 4 year old could write the application, but it's the process that counts, right ? smile_wink

To create the application you will need to launch a second instance of Visual Studio 2005 and create a Smart Device Project, C#, for Windows CE 5.0 - note that even though we're creating a Windows CE 5.0 application this will run just fine on CE 6.0. The important thing here is the abstraction given by the .NET Compact Framework, so the application really doesn't care whether it's running on CE 5.0 or CE 6.0.

My Emulator image is running at 320x240 resolution, so I will need to adjust the form size within Visual Studio to match the size of my emulator screen resolution.

Since a typical Compact Framework application has a title bar, minimize box etc... we need to remove the appropriate styles from the form - this can be done programatically or by using the code from the link. I also removed the "mainMenu" from the application, because this will draw over the client area of the applicaiton even if I don't actually have any menu items included in my application!

Here's the finished applicaiton, looks pretty sweet!


So that's Step 2 completed, we now have a .NET Compact Framework 2.0, C# application that's destined to be the shell of our CE 6.0 based Embedded device.

Step 3 - Create a launcher for our application.

Even if we include the kiosk application in our operating system image it wont be launched at startup, to understand how to launch a program at startup take a look at the following blog post "Windows CE Kiosk Mode - Part 11" - the one difference is the location of the shared source for the explorer.cpp file, which can be found in - \wince600\public\shell\oak\hpc\explorer\main\explorer.cpp - the underlying code for the ProcessStartupFolder function is the same as CE 5.0 (you can find the code snippet here - "Windows CE Kiosk Mode - Part 11") - I had a number of e-mails about the CE 5.0 Kiosk Mode blog post where some people didn't understand where the PlatformStartup application comes from - Once you have configured your base operating system image (without a shell) you will need to add a sub-project, perhaps use the "Simple Windows Embedded CE Application" template as your starting point and then just drop in the code from the Kiosk Mode 11 sample blog (link just above).

Here's how my solution looks with the Win32 C/C++ "PlatformStartup" sub-project added.


One of the benefits of creating the PlatformStartup sub-project is that we get a series of ParameterFiles created for the project, this gives us a local set of REG, BIB, DAT, and DB files that we can use to add project specific information to the operating system image. Our kiosk needs to launch the PlatformStartup application at boot time, we can edit the PlatformStartup.REG file (in the Parameter Files folder of the sub-project) to add a launch key to the registry. Here's the registry information.


Note that the Dependency key is used to make sure that GWES and the device driver manager are both up and running.


Step 4 - Integrating the managed application (and mapping to the \Startup folder).

I've used CEFileWiz to create a custom PBCXML file (Platform Builder Component XML file) that gives me everything I need to directly add the C# application binary to the CE 6.0 platform workspace. The interesting thing is how to map the ShellApp.exe from the \Windows folder (the default location for any application or file in the Windows CE O/S) - CEFileWiz creates a project file that doesn't compile/link anything, but instead makes sure the bib, dat, reg etc.. are setup correctly to include the application/file into the o/s - Here's a short video that shows how to integrate the application (or files) into the operating system design.

For our ShellApp.exe we want to map the application from the \Windows folder to the \Startup folder, this is very easy - here's the ShellApp.dat file (the DAT file is created by CEFileWiz and lives in the Parameter Files folder as part of the sub-project).



And the end result ? - a CE 6.0 operating system image that can still be customized by adding the technologies you need, and at the same time makes it super easy to create kiosk type devices

And here's the final custom shell application up and running... Doesn't the managed application UI look great!


- Mike