Click here to Skip to main content
12,882,820 members (35,971 online)
Click here to Skip to main content
Add your own
alternative version


Posted 5 Jun 2012

Windows Mobile: Kiosk Mode Series - Part 2

, 5 Jun 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
Task bar application using the Compact Framework

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 probably 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 accidentally changes connection settings.

Full Screen, No Taskbar

You can make your application fullscreen and all this status information is no more available 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 cannot invoke the popup menu and will only hear 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 by setting the registry value: TASKBAR_DATACONNECTION in key “HKEY_LOCAL_MACHINE\Software\Microsoft\Shell\Rai” to your own, custom, application.

public static bool setCustomHandler(titleBarEvents titleName)
    string regName = ":" + titleName.ToString();
    string sKey = sSubKey + @"\" + regName;
    bool bRet = true;
        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);

    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 = "";
        addText("setCustomHandler = OK");
        addText("setCustomHandler = Failed");

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


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.


Full source with demo app available at (you need a subversion client like TortoiseSVN or the VisualStudio AddOn AnkhSVN).


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Germany Germany
No Biography provided

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170422.1 | Last Updated 5 Jun 2012
Article Copyright 2012 by hjgode
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid