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 Embedded Handheld(称为Windows Mobile),Microsoft重新设计了用户界面。 “开始”图标向下移动到菜单栏区域内的底部。
![Windows Mobile Screen Layout](https://i-blog.csdnimg.cn/blog_migrate/7465b19fd0d85c59e10448d0f6e2d24f.gif)
![Windows Embedded Screen Layout](https://i-blog.csdnimg.cn/blog_migrate/08530a7bca0f0221c3a90a9911f2e651.gif)
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!
如果您需要隐藏“开始”图标和/或SIP(软输入面板,软件键盘按钮),则通常使用MS Mobile SDK SHFullscreen API。 但这不适用于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\B
因此,要解决此问题,您可以更改注册表并使操作系统认为,它具有用于启动图标的硬件密钥。 HKLM中有三个可能的条目负责设计SOFTWARE \ Microsoft \ Shell \ B中的菜单栏 ubbleTiles :
"TextmodeEnabled"=DWORD:0/
“ TextmodeEnabled” = DWORD:0 / 1个
"HardwareStartKeyEnabled"=
“ HardwareStartKeyEnabled” = 双字:0/1
"HardwareDoneKeyEnabled"=D
“ HardwareDoneKeyEnabled” = D 字: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.
TextModeEnable控制菜单栏的绘制方式。 O表示菜单栏的常规图形绘制,1表示菜单栏的基于文本的绘制。
HardwareStartKeyEnabled controls the display of the Start Icon.
HardwareStartKeyEnabled控制“开始”图标的显示。
HardwareDoneKeyEnabled controls the display of the (OK) button inside the menu bar.
HardwareDoneKeyEnabled控制菜单栏内(OK)按钮的显示。
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.
现在,您可以将HardwareStartKeyEnabled更改为1,操作系统会认为该设备具有硬件启动按钮,并且不再在菜单栏的左侧显示图标。 更改注册表项后,将显示所有新窗口,而没有开始图标。 或者,当您重新启动时,开始图标将不再对任何窗口或应用程序可见。
SHFullscreen has no function in WEH
SHFullscreen在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.
由于SHFullscreen不适用于WEH的SHFS_HIDESTARTICON,因此您可以使用此注册表项在应用程序中隐藏启动图标。 随附的是称为LockDown(名称空间LockDown)的Compact Framework类,您可以使用该类来保存上述注册表项的当前状态以及更改和还原这些项。
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:
您可以在显示第一个表格之前使用该类。 第一种形式通常是从项目的program.cs代码文件启动的:
...
static void Main...
Lockdown.LockDown.SaveRegistryFullScreen();
Lockdown.LockDown.SetRegistryFullScreen(false, true, false);
Application.Run(new FormMain(args));
Lockdown.LockDown.RestoreRegistryFullScreen();
...
The static function LockDown.SetRegistryFullSc
静态函数LockDown.SetRegistryFullSc reen需要三个布尔参数。 第一个启用或禁用“开始”图标的显示,第二个对菜单栏中的“完成/确定”按钮执行相同的操作,最后一个控制菜单栏的TextMode显示。 因此,隐藏或显示新表单的开始图标非常容易。
The SIP (software keyboard button)
SIP(软件键盘按钮)
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.
可以与SHFullscreen一起使用的另一个参数SHFS_HIDESIPBUTTON不再与Windows Embedded Handheld一起使用。 SHFullscreen功能仅返回OK,但是SIP按钮在菜单栏中仍然可见。
To work around this, we can use the Miccrosoft Windows Mobile SDK functions FindWindow and ShowWindow:
要解决此问题,我们可以使用Miccrosoft Windows Mobile SDK函数FindWindow和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));
}
}
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).
这个紧凑的框架代码先找到SIP按钮的父窗口,然后找到按钮(也是每个元素一样的窗口)。 然后它隐藏或显示窗口(按钮)。
This is very easy to use in a compact framework application, just call ShowKeyboardSIP(bShow); where you need to hide or show the SIP.
这在紧凑的框架应用程序中非常容易使用,只需调用ShowKeyboardSIP(bShow);即可。 您需要隐藏或显示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.
可以与SHFullscreen一起使用的第三个可能的参数是SHFS_HIDETASKBAR。 在Visual Studio(2003/2005/2008)中,您只需要将Forms WindowState属性设置为Maximized即可隐藏任务栏。 具有最大化windowstate的所有窗体将显示没有任务栏。
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.
附件的类文件包含一些您可以使用的功能。 它还可以使用SHFullscreen,因此您可以在Windows Mobile(6.1)和Windows Embedded Handheld(6.5.3)上测试功能。 您也可以在可用的Windows Mobile仿真器中不受限制地尝试代码。
Have fun coding
玩得开心编码
Josef
约瑟夫
[a demo using the class is available at code.google.com/p/weh653ki
[使用该类的演示可在code.google.com/p/weh653ki上找到。 osmodes /]
Lockdown.cs Lockdown.cs