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.

 

你可能感兴趣的:(windows,function,null,delete,input,methods)