Windows Mobile: Kiosk Mode Series, part 2

In the first part of this series I showed how to make your compact framework application full screen or remove the Start icon from the menu bar. Now we will take a look at the task bar.

The task bar is at the top of your screen (except for fullscreen applications) and shows valuable information like the connection status, battery status or the current time.

Not full screen, taskbar not locked

This is a kiosk mode risk. The user is able to click the symbols in the taskbar and gets a popup menu with some icons. These icons enable the user to change connection settings, power management settings and others. You propably do not want to allow the user to make changes to some or all of the possible changes.

For example, clicking on the phone or signal strength icon will bring up this dialog:

The user can then change connection settings and activate or deactivate radios. Possibly a source for a bunch of support calls, if the user accidently changes connection settings.

Full screen, no taskbar

You can make your application fullscreen and all this status information is no more visible to the user. You should then provide the user with your own set of status information.

Do not leave the user in an unknown state. He/she should at least know the battery and connection status.

Not full screen, taskbar locked

The simplest way to show the user status information but disallow any changes is to show the taskbar but in a disabled state.

The attached class FullScreen has a simple function to lock or unlock the taskbar:

        public bool enableTaskbar(bool bEnable)
        {
            bool bRet = false;
            IntPtr hTaskbar = FindWindow("HHTaskBar", String.Empty);
            if (hTaskbar != IntPtr.Zero)
                bRet = EnableWindow(hTaskbar, bEnable);
            return bRet;
        }

The demo application can be used to test the function:

If “Lock Taskbar” is checked, a user can not invoke the popup menu and will only here a beep, when the taskbar is clicked. Disabling the taskbar is the simplest way to keep the user from using the taskbar.

Not full screen, taskbar not locked, using custom settings applications

If one clicks any of the icons in the popup menu, Windows Mobile launches a defined application with a command line argument. The assignments are defined in the registry of the device. You can leave the taskbar enabled and present the user your custom status applications.

I call the popup menu of the taskbar also “titlebar pulldownlist”. In the class CustomTitleBar I have implemented a function that replaces the windows mobile handler application for an icon. For example, you can replace the handler application for the dataconnection icon (the most left near the Zoom icon) by setting the registry value
:TASKBAR_DATACONNECTION in key
“HKEY_LOCAL_MACHINE\Software\Microsoft\Shell\Rai”
to your own, custom, application.

HKEY_LOCAL_MACHINE\Software\Microsoft\Shell\Rai
    :TASKBAR_DATACONNECTION
        "0"="OEM_DataConnection"
        "1"="\windows\OEMTitleBarHandler.exe /DataConnection"
    :TASKBAR_RADIOSIGNAL
    :TASKBAR_VOLUME
    :TASKBAR_BATTERY
    :TASKBAR_CLOCK
see also MSDN.
The below code snippet shows how to use the class to set a custom handler application.
        public static bool setCustomHandler(titleBarEvents titleName)
        {
            string regName = ":" + titleName.ToString();
            string sKey = sSubKey + @"\" + regName;
            bool bRet = true;
            try
            {
                RegistryKey regKey = Registry.LocalMachine.OpenSubKey(sKey, true);
                if (regKey == null)
                {
                    regKey = Registry.LocalMachine.CreateSubKey(sKey);
                }
                regKey.SetValue("0", "OEM_DataConnection", RegistryValueKind.String);
                regKey.SetValue("1", @"\windows\OEMTitleBarHandler.exe" + " /" + titleName, RegistryValueKind.String);
                regKey.Flush();

                regKey.Close();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception in setCustomHandler(): " + ex.Message);
                bRet = false;
            }
            return bRet;
        }

The class is simple to use. After the custom handler is installed (no reboot required), you will get your custom app shown, if you click the dataconnection (or other) icon.

        private void mnuSet_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            if(CustomTitleBar.setCustomHandler(CustomTitleBar.titleBarEvents.TASKBAR_DATACONNECTION))
                addText("setCustomHandler = OK");
            else
                addText("setCustomHandler = Failed");
            dumpSettings();
        }

At the top of the window of the demo app you can read:

/TASKBAR_DATACONNNECTION

This is the command line argument passed to the titlebar handler application.

With the class CustomTitleBar you can set, get and reset the handler applications.

Downloads

[Download not found] [Download not found]

Full source with demo app available at code.google.com/p/weh653kiosmodes/source/checkout (you need a subversion client like TortoiseSVN or the VisualStudio AddOn AnkhSVN)

9 Comments

  1. cem says:

    Hi,
    i downloaded the code from code.google.com/p/weh653kiosmodes/source/checkout. It is working great.
    I want to learn how to add an application to blacklist on Windows CE devices like Casio DTX30.
    Your code works on windows mobile but not on windows ce.
    I want to prevent changing date time on windows ce device, how can i do this?
    thank you.

  2. admin says:

    Blacklisting is a Windows Mobile feature and not available on Windows CE devices.

    As the OEM can do what they want with Windows CE, there will be no general solution.

    You should write/use a kiosk mode launcher, so the user is restricted to allowed apps and settings only.

  3. alex says:

    Hi,
    I added clock.exe to blacklist on windows mobile devices. I only permit changing date/time in my application with a password. Users can not change date/time, it is ok.
    On windows mobile 5.0 devices(for example Intermec CN3 or emulator), I am running clock.exe in my application with a password, but something cause closing my application. There is no error, no warning in debug mode. Have you ever tested blacklist property in wm 5.0 and did you see any problem like that? What do you think about this bug? thank you for your supply.

  4. admin says:

    Hello alex

    I did not test it but I have some suggestion:
    You can not launch a blacklisted program. So, if clock.exe is blacklisted, you can not use CreateProcess or similar to launch clock.exe from inside your application.
    I recommend to either use another way to keep the user from running clock.exe directly or you write your own clock.exe and implement the functions you allow to the user.

    ~josef

  5. Hoi Free says:

    Hi,

    Is it possible to restrict the IE in Windows Mobile 6.5.x such that user cannot alter the settings such as:

    – home page;
    – favorite;
    – zoom scale etc.

    Thanks!

  6. admin says:

    Hello Hoi

    no, there are not these options to run IEMobile in kiosk mode. Ask your device OEM for a locked down browser like Intermec is offering Intermec Browser. Or use a general kiosk mode browser as for example availabe by Naurtech or wavelink.

    You may also write your own kiosk mode browser (this is a developer site) using the InternetExplorer Mobile browser COM object.

    ~Josef

  7. josef says:

    NOTE:
    changing Shell\RAI\:TASKBAR_VOLUME to a dummy exe will also disable the volume popup dialog

    ie: launch file explorer instead of showing the volume popup

    REGEDIT4

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Shell\Rai\:TASKBAR_VOLUME]
    “1”=”fexplore.exe”
    “0”=”FExplore”

    ~josef

  8. David says:

    For Android we are using Scalefusion kiosk app

  9. josef says:

    Hi David

    I approved your comment although this post is about Windows Mobile.

    ~Josef

Leave a Reply