Recently, you need to write a full-screen program. In the past, we used showwindow in wince to hide the taskbar. However, in WM, There Is A Start Menu Bar,
I used a Chinese keyword to Google the circle, but I still did not get it out. I finally found a function shfullscreen with the English keyword. (msdn says this function can be used for wince, but the test failed)
Specific implementation:
Public class Win32
{
[Dllimport ("aygshell. dll")]
Public static extern bool shfullscreen (intptr hwnd, uint dwstate );
// Http://msdn.microsoft.com/en-us/library/aa930139.aspx
Const uint shfs_showtaskbar = 0x1; // taskbar
Const uint shfs_hidetaskbar = 0x2;
Const uint shfs_showsipbutton = 0x4; // Input Method
Const uint shfs_hidesipbutton = 0x8;
Const uint shfs_showstarticon = 0x10; // Start Menu Bar
Const uint shfs_hidestarticon = 0x20;
/// <Summary>
/// Full screen display, that is, hide the taskbar (and start menu bar) of WM and Win CE)
/// </Summary>
/// <Param name = "hwnd"> the form handle to be displayed </param>
/// <Param name = "isfull"> true full screen, false cancel full screen </param>
/// <Returns> </returns>
Public static bool fullscreen (intptr hwnd, bool isfull)
{
Uint dwstate = 0;
If (isfull)
{
Dwstate = shfs_hidetaskbar | shfs_hidesipbutton | shfs_hidestarticon;
}
Else
{
Dwstate = shfs_showtaskbar | shfs_showsipbutton | shfs_showstarticon;
}
Return win32.shfullscreen (hwnd, dwstate );
}
}
Form constructor calls:
This. windowstate = formwindowstate. maximized; // This sentence cannot be less, and note that the size of the form is the same as that of the screen.
Win32.fullscreen (this. Handle, true); // This example passes the test on Windows Mobile 6.1
After the form is started, it will be located on the Start menu and taskbar, and it is better than hiding the taskbar, because if the taskbar is hidden, the program will display the taskbar when exiting, it's not good if the program unexpectedly exits.