I would like to start a series of articles of how you can lockdown your application user in your application. How can you achieve a kiosk mode application, where the user is only allowed to do what you define.
The first article is about the Windows Start and Done Icon in menu bar and about fullscreen. You may already know how to hide the start and done icon permanently from a Windows Embedded Handheld (Windows Mobile 6.5.3) device: Link
But there is also a temporary way using the same approach. The trick is to change the registry keys, that make the OS believe you have hardware buttons for Start and Done, before you show your C# form.
Before Windows Embedded Handheld (WEH, or Windows Mobile 6.5.3), you are able to use
SHFullScreen API calls. But this will not work with WEH. Neither the flags
SHFS_HIDESTARTICON will work. The LockDown.cs class also includes code for that and you may test the functions with the Test-Application.
The class I am talking about is called
LockDown. There is also a Test-Application (
OEMTitleBarHandler, don't ask me about the name selection) to test all functions I will describe.
Left is Windows Mobile 6.1 and right image shows Windows Embedded Handheld 6.5.3! You can use the
ShFullScreen menu on both, but it will only work with Mobile 6.1. But the test “Form without StartIcon” will bring up a form without Start button.
OK, let’s look at what we can do to hide the Start icon for a new form:
private void mnuStartIconTestForm_Click(object sender, EventArgs e)
Lockdown.LockDown.SetRegistryFullScreen(true, false, false);
LockDownTestForm frm = new LockDownTestForm();
SaveRegistryFullScreen() saves the state of the registry values of
HardwareDoneKeyEnabled below “HKLM\SOFTWARE\Microsoft\Shell\BubbleTiles”.
SetRegistryFullScreen(bool bStartButtonPresent, bool bDoneButtonPresent, bool bTextMode) sets the registry key according to the args. So, if
bStartButtonPresent is set to
true, the registry value of
HardwareStartKeyEnabled is set to
1. With this setting, the next form or window is shown without Start button. Easy, isn’t it. The other args work similar.
RestoreRegistryFullScreen will restore the registry to the state saved with
How can you remove all buttons that enable the user to quit or minimize a form? To show a compact framework form with or without Done or Minimize buttons, you just have to set the right properties of the form. But don't forget to give the user an option to get back from a form.
ControlBox property switches the (X)/ (OK) button display. The clicking an (OK) button will close and exit a form or application:
private void mnuControlBox_Click(object sender, EventArgs e)
this.ControlBox = false;
mnuControlBox.Checked = false;
this.ControlBox = true;
mnuControlBox.Checked = true;
MinimizeBox property of a compact framework form switches the (OK) button to a (X) button. Where (X) stands for minimize window.
private void mnuMinimizeBox_Click(object sender, EventArgs e)
this.MinimizeBox = false;
mnuMinimizeBox.Checked = false;
this.MinimizeBox = true;
mnuMinimizeBox.Checked = true;
The Test application has also menu options to test these properties as “Window Options”.
The menu option Maximize shows the testform maximized (oh, wonder), but that means only, that the taskbar at the top is hidden and the client area is larger. If you additionally set the menu to
null, you will get a real full screen form:
You have to press the Escape key (hopefully you have one) to bring the menu back in the test application.
The class file
LockDown offers some more functions, but these are left for another article.
The whole code with the test application is available here. You need a subversion client like TortoiseSVN or AnkhSVN to checkout the source code.