Windows Mobile enables full screen to hide the taskbar and menu bar

Source: Internet
Author: User

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
}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.