hide the task bar and input panel in Windows Mobile

when develop the WM apps sometimes we need to hide the task bar and input panel.

here some methods are introduced with both C++ and C#.

 

C++:

by the function SHFullScreen(), we may hide and show the taskbar, Input Panel button, or Start menu icon.

and it's easy to use.

// hide

void CHideInputDlg::OnBnClickedButton1()

{

    BOOL bRet = false;

    RECT rc;

 

    DWORD dwState = (SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);

    bRet = SHFullScreen(m_hWnd, dwState);

    // Next resize the main window to the size of the screen.

    SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));

    MoveWindow(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);

 

}

 

// show

void CHideInputDlg::OnBnClickedButton2()

{

    BOOL bRet = false;

    RECT rc;

 

    DWORD dwState = (SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON);

    bRet = SHFullScreen(m_hWnd, dwState);

   

    // Next resize the main window to the size of the work area.

    SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, FALSE);

    MoveWindow(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);

}

 

SDK link:

ms-help://MS.VSCC.v80/MS.VSIPCC.v80/MS.WindowsMobile.6/WindowsMobile6SDK/html/8d06e91f-a53f-4a09-add0-d7c25b589a9c.htm

 

and there is another more classical way to hide or even disable the task bar: find it's handle and do what ever we want. But the method doesn't work for input panel.

 

// hide

void CHideInputDlg::OnBnClickedButton3()

{

    HWND pWin = NULL;

    pWin = ::FindWindowW(_T("HHTaskBar"), _T(""));

    ::ShowWindow(pWin, SW_HIDE);

    //::EnableWindow(pWin, FALSE);

    RECT rc;

    SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));

    MoveWindow(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);

}

 

// show

void CHideInputDlg::OnBnClickedButton4()

{

    HWND pWin = NULL;

    pWin = ::FindWindowW(_T("HHTaskBar"), _T(""));

    ::ShowWindow(pWin, SW_SHOW);

 

    RECT rc;

    SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, FALSE);

    MoveWindow(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);

}

 

by the way notes that both the height of task bar and the input panel are 26.

 

C#

while in the C# platform, the work is much easier,

just change the property of the form:

    FormBorderStyle: None;

    WindowState: Maximized;

    Size:  your screen size;

by the setting, the task bar is covered, put the input panel is still there, cause the panel is associated with the component MainMenu, just delete the component, we would get a clean screen.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值