Kiosk Mode: Hide Start Icon, SIP button without SHFullscreen on Windows Embedded Handheld 6.5.3

hjgodeTier 3 Senior Technical Support Engineer
CERTIFIED EXPERT
Published:
With Windows Embedded Handheld, called Windows Mobile, Microsoft re-designed the user interface. The Start Icon moved down to the bottom, inside the menu bar area.

Windows Mobile Screen Layout  Windows Embedded Screen Layout
If you need to hide the Start Icon and/or the SIP (soft input panel, software keyboard button), you normally use the MS Mobile SDK SHFullscreen API. But this will not work for Windows Embedded Handheld!

So, to workaround this, you can change the registry and make the OS think, it has a hardware key for the start icon. There are three possible entries inside HKLM responsible for the design of the menu bar at SOFTWARE\Microsoft\Shell\BubbleTiles:
"TextmodeEnabled"=DWORD:0/1
"HardwareStartKeyEnabled"=DWORD:0/1
"HardwareDoneKeyEnabled"=DWORD:0/1

TextModeEnable controls the way the menu bar is drawn. O is for normal, graphic draw of the menu bar and 1 is used to define a text based draw of the menu bar.
 
HardwareStartKeyEnabled controls the display of the Start Icon.

HardwareDoneKeyEnabled controls the display of the (OK) button inside the menu bar.

Now you can change HardwareStartKeyEnabled to 1 and the OS will think, the device has a hardware start button and does no more display an icon on the left of the menu bar. After you changed the registry key, all new windows will show without the start icon. Or, when you reboot, the start icon will not more being visible for any window or application.

SHFullscreen has no function in WEH

As SHFullscreen does not work for SHFS_HIDESTARTICON for WEH, you can use this registry key to hide the start icon in your application. Attached is a Compact Framework class called LockDown (namespsace LockDown) you can use to save the current state of the above registry keys and change and restore the keys.

You can use the class before your first form is displayed. The first form is normally launched from your project's program.cs code file:

...
                       static void Main...
                         Lockdown.LockDown.SaveRegistryFullScreen();
                         Lockdown.LockDown.SetRegistryFullScreen(false, true, false);
                         Application.Run(new FormMain(args));
                         Lockdown.LockDown.RestoreRegistryFullScreen();
                      ...

Open in new window


The static function LockDown.SetRegistryFullScreen needs three boolean arguments. The first enables or disables the display of the Start Icon, the second does the same for the Done/OK button in the menu bar and the last controls the TextMode display of the menu bar. So it is very easy to hide or show the start icon for a new form.

The SIP (software keyboard button)

Another argument you can use with SHFullscreen, that does not work any more with Windows Embedded Handheld is SHFS_HIDESIPBUTTON. The SHFullscreen function just returns OK, but the SIP button will still be visible in the menu bar.
To work around this, we can use the Miccrosoft Windows Mobile SDK functions FindWindow and ShowWindow:

...
                              [DllImportAttribute("coredll.dll", EntryPoint = "FindWindow", SetLastError = true, PreserveSig = true, CallingConvention = CallingConvention.Winapi)]
                              private static extern IntPtr FindWindow(string className, string wndName);
                              [DllImportAttribute("coredll.dll", EntryPoint = "ShowWindow", SetLastError = false, PreserveSig = true, CallingConvention = CallingConvention.Winapi)]
                              [PreserveSigAttribute()]
                              public static extern bool ShowWindow(IntPtr hWnd, int cmdShow);
                      ...
                              public static void ShowKeyboardSIP(bool bShow)
                              {
                                  IntPtr intPtr1 = FindWindow("MS_SIPBUTTON", "MS_SIPBUTTON");
                                  if (intPtr1 == IntPtr.Zero)
                                  {
                                      return;
                                  }
                                  IntPtr intPtr2 = GetWindow(intPtr1, (uint)GetWindowFlags.GW_CHILD);
                                  if (intPtr2 != IntPtr.Zero)
                                  {
                                      bool b1 = ShowWindow(intPtr2, (bShow ? (int)(ShowWindowFlags.SW_SHOWNORMAL | ShowWindowFlags.SW_SHOWNOACTIVATE) : 0 ));// 5 : 0));
                                      bool b2 = ShowWindow(intPtr1, (bShow ? (int)(ShowWindowFlags.SW_SHOWNORMAL | ShowWindowFlags.SW_SHOWNOACTIVATE) : 0));// 5 : 0));5 : 0));
                                  }
                              }

Open in new window


This compact framework code finds the parent window of the SIP button and then the button (which is also a window, like every element). Then it hides or shows the window (button).

This is very easy to use in a compact framework application, just call ShowKeyboardSIP(bShow); where you need to hide or show the SIP.

The third possible argument you can use with SHFullscreen is SHFS_HIDETASKBAR. Within Visual Studio (2003/2005/2008) you just have to set the Forms WindowState property to Maximized to hide the taskbar. All forms with maximized windowstate will show without taskbar.

The attached class file contains some more functions you can play with. It also can use SHFullscreen, so you can test the functionality on Windows Mobile (6.1) and Windows Embedded Handheld (6.5.3). You can try the code without restrictions also in the available windows mobile emulators.

Have fun coding

Josef

[a demo using the class is available at code.google.com/p/weh653kiosmodes/]
Lockdown.cs
1
10,763 Views
hjgodeTier 3 Senior Technical Support Engineer
CERTIFIED EXPERT

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.