1.Hide 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, remember to restore the taskbar when the program exits. Otherwise, the taskbar will not appear automatically.
2. shfullscreenHide 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. the related code is as 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 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,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
}