To achieve full screen effect in Windows Mobile, you need to consider two aspects.
The mobile system interface, as shown in, needs to hide the taskbar at the top of the screen and the menu bar at the bottom.
Hide taskbarThere are two methods, one is to completely hide, the other is to adjust the display of the taskbar by using the API.
1. Hide the taskbar permanently:
// Hide the taskbar
Cwnd * pwndtask = findwindow (_ T ("hhtaskbar"), null );
If (pwndtask)
{
Pwndtask-> showwindow (sw_hide );
}
Crect RC;
Setrect (& rc, 0, 0, getsystemmetrics (sm_cxscreen), getsystemmetrics (sm_cyscreen ));
Movewindow (RC );
When using this method, rememberProgramYou must restore the taskbar when exiting. Otherwise, the taskbar will not appear automatically.
2. Use shfullscreen to hide the taskbar:
Setforegroundwindow ();
DWORD dwstate = (shfs_hidetaskbar | shfs_hidestarticon | shfs_hidesipbutton );
: Shfullscreen (m_hwnd, dwstate );
Crect RC;
Setrect (& rc, 0, 0, getsystemmetrics (sm_cxscreen), getsystemmetrics (sm_cyscreen ));
Movewindow (RC );
This method hides the taskbar and does not require any special processing when the program exits. however, when processing windows such as cwnd and cframewnd, you must first setforegroundwindow once, while windows of the cdialog type do not need this step.
In addition, when processing windows of the cwnd and cframewnd types, you must also respond to the wm_activate message and perform the same processing to completely hide the taskbar effect.
The message is also called when the program exits and the window is switched. Therefore, directly responding to the message will cause refresh of the taskbar after the program exits, and the window cannot be switched out. the solution is to set the member variables to determine whether the program exits and check the parameters of the message to determine whether to switch the window. relatedCodeAs follows:
Void cmainframe: onactivate (uint nstate, cwnd * pwndother, bool bminimized)
{
Cframewnd: onactivate (nstate, pwndother, bminimized );
If (! Nstate &&! Pwndother)
Return;
If (! M_bexit)
{
// Full screen window
Setforegroundwindow ();
DWORD dwstate = (shfs_hidetaskbar | shfs_hidestarticon | shfs_hidesipbutton );
: Shfullscreen (m_hwnd, dwstate );
Crect RC;
Setrect (& rc, 0, 0, getsystemmetrics (sm_cxscreen), getsystemmetrics (sm_cyscreen ));
Movewindow (RC );
}
}
Hide the menu bar belowThere is only one method. The first method for hiding the taskbar is similar to the following:
// Hide the input field
Cwnd * pwndsip = findwindow (_ T ("menu_worker"), null );
If (pwndsip)
{
Pwndsip-> showwindow (sw_hide );
}
The window must be restored when the program exits, otherwise this column will not appear automatically.
In many casesOnly the taskbar needs to be hidden, but the input field below does not need to be hidden.Such as mobile QQ. however, when the keyboard for the input method is displayed, the window on the screen automatically shrinks down and the area of the hidden taskbar is displayed. the solution is to respond to the wm_wininichange message in the main window. You do not need to add custom code in it, as shown below:
// The taskbar is not automatically displayed when you press the input method.
Void cmainframe: onwininichange (lpctstr lpszsection)
{
Cframewnd: onwininichange (lpszsection );
// Todo: add the message processing program code here
}