隐藏系统任务栏
原文链接:http://blog.csdn.net/flyoxs/article/details/4171137
最简单的方法为:
FindWindow("Shell_TrayWnd",NULL)->ShowWindow(SW_HIDE);
上面代码确能隐藏任务栏,但是,随便打开一个窗口最大化,原来任务栏的地方仍被空白占据着。调用Win32 API- SystemParametersInfo(SPI_SETWORKAREA),重新设置桌面工作区域,可解决这个问题,代码如下:
void gShowHideTaskBar(BOOL bHide /*=FALSE*/) { CRect rectWorkArea = CRect(0,0,0,0); CRect rectTaskBar = CRect(0,0,0,0); CWnd* pWnd = CWnd::FindWindow(_T("Shell_TrayWnd"), NULL); if( bHide ) { // Code to Hide the System Task Bar SystemParametersInfo(SPI_GETWORKAREA, 0, (LPVOID)&rectWorkArea, 0); if( pWnd ) { pWnd->GetWindowRect(rectTaskBar); rectWorkArea.bottom += rectTaskBar.Height(); SystemParametersInfo(SPI_SETWORKAREA, 0, (LPVOID)&rectWorkArea, 0); pWnd->ShowWindow(SW_HIDE); } } else { // Code to Show the System Task Bar SystemParametersInfo(SPI_GETWORKAREA, 0, (LPVOID)&rectWorkArea, 0); if( pWnd ) { pWnd->GetWindowRect(rectTaskBar); rectWorkArea.bottom -= rectTaskBar.Height(); SystemParametersInfo(SPI_SETWORKAREA, 0, (LPVOID)&rectWorkArea, 0); pWnd->ShowWindow(SW_SHOW); } } }
天道酬勤 循序渐进 技压群雄