Function is used to Show/Hide the TaskBar
2005-03-21 09:00
253 查看
// CoolUtils.h
#ifndef __COOLUTILS_H
#define __COOLUTILS_H
#include "stdafx.h"
void gShowHideTaskBar(/*in*/BOOL bHide = FALSE);
HMENU gHideMenu(/*in*/CWnd* pWnd);
BOOL gShowMenuBack(/*in*/HMENU hMenu, /*in*/CWnd* pWnd);
#endif
// CoolUtils.cpp
#include "stdafx.h"
#include "CoolUtils.h"
/****************************************************************************
* Function Name : gShowHideTaskBar() *
* Parameters : BOOL bHide (flag to toggle Show/Hide of Taskbar) *
* Return type : void *
* Purpose : Function is used to Show/Hide the TaskBar *
* Author : Ashutosh R. Bhatikar (ARB) *
* Date written : 20th December 2000 *
* Modification History : *
* Date of modification Reason *
* 25th December 2000 Added methods to Show/Hide menu *
****************************************************************************/
void gShowHideTaskBar(BOOL bHide /*=FALSE*/)
{
CRect rectWorkArea = CRect(0,0,0,0);
CRect rectTaskBar = CRect(0,0,0,0);
CWnd* pWnd = CWnd::FindWindow("Shell_TrayWnd", "");
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);
}
}
}
/****************************************************************************
* Function Name : gHideMenu() *
* Parameters : CWnd* pWnd (Window associated with the menu) *
* Return type : HMENU *
* Purpose : Function hides the menu associated with pWnd *
* Author : Ashutosh R. Bhatikar (ARB) *
* Date written : 25nd December 2000 *
* Modification History : *
* Date of modification Reason *
****************************************************************************/
HMENU gHideMenu(/*in*/CWnd* pWnd)
{
HMENU hMenu = ::GetMenu(pWnd->GetSafeHwnd());
if (hMenu != NULL)
{
// Invalidate before SetMenu since we are going to replace
// the frame's client area anyway
pWnd->Invalidate();
pWnd->SetMenu(NULL);
if( pWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd)) )
{
CFrameWnd* pFrameWnd = (CFrameWnd*)pWnd;
// avoid any idle menu processing
pFrameWnd->m_nIdleFlags &= ~CFrameWnd::idleMenu;
}
return hMenu;
}
return NULL;
}
/****************************************************************************
* Function Name : gShowMenuBack() *
* Parameters : HMENU hMenu (Handle of the menu which was hidden) *
* CWnd* pWnd (Window associated with the menu) *
* Return type : BOOL *
* Purpose : Function shows back the menu associated with pWnd *
* Author : Ashutosh R. Bhatikar (ARB) *
* Date written : 25nd December 2000 *
* Modification History : *
* Date of modification Reason *
****************************************************************************/
BOOL gShowMenuBack(/*in*/HMENU hMenu, /*in*/CWnd* pWnd)
{
// put the menu back in place if it was removed before
if (hMenu != NULL)
{
// Invalidate before SetMenu since we are going to replace
// the frame's client area anyway
pWnd->Invalidate();
::SetMenu(pWnd->GetSafeHwnd(), hMenu);
return TRUE;
}
return FALSE;
}
#ifndef __COOLUTILS_H
#define __COOLUTILS_H
#include "stdafx.h"
void gShowHideTaskBar(/*in*/BOOL bHide = FALSE);
HMENU gHideMenu(/*in*/CWnd* pWnd);
BOOL gShowMenuBack(/*in*/HMENU hMenu, /*in*/CWnd* pWnd);
#endif
// CoolUtils.cpp
#include "stdafx.h"
#include "CoolUtils.h"
/****************************************************************************
* Function Name : gShowHideTaskBar() *
* Parameters : BOOL bHide (flag to toggle Show/Hide of Taskbar) *
* Return type : void *
* Purpose : Function is used to Show/Hide the TaskBar *
* Author : Ashutosh R. Bhatikar (ARB) *
* Date written : 20th December 2000 *
* Modification History : *
* Date of modification Reason *
* 25th December 2000 Added methods to Show/Hide menu *
****************************************************************************/
void gShowHideTaskBar(BOOL bHide /*=FALSE*/)
{
CRect rectWorkArea = CRect(0,0,0,0);
CRect rectTaskBar = CRect(0,0,0,0);
CWnd* pWnd = CWnd::FindWindow("Shell_TrayWnd", "");
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);
}
}
}
/****************************************************************************
* Function Name : gHideMenu() *
* Parameters : CWnd* pWnd (Window associated with the menu) *
* Return type : HMENU *
* Purpose : Function hides the menu associated with pWnd *
* Author : Ashutosh R. Bhatikar (ARB) *
* Date written : 25nd December 2000 *
* Modification History : *
* Date of modification Reason *
****************************************************************************/
HMENU gHideMenu(/*in*/CWnd* pWnd)
{
HMENU hMenu = ::GetMenu(pWnd->GetSafeHwnd());
if (hMenu != NULL)
{
// Invalidate before SetMenu since we are going to replace
// the frame's client area anyway
pWnd->Invalidate();
pWnd->SetMenu(NULL);
if( pWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd)) )
{
CFrameWnd* pFrameWnd = (CFrameWnd*)pWnd;
// avoid any idle menu processing
pFrameWnd->m_nIdleFlags &= ~CFrameWnd::idleMenu;
}
return hMenu;
}
return NULL;
}
/****************************************************************************
* Function Name : gShowMenuBack() *
* Parameters : HMENU hMenu (Handle of the menu which was hidden) *
* CWnd* pWnd (Window associated with the menu) *
* Return type : BOOL *
* Purpose : Function shows back the menu associated with pWnd *
* Author : Ashutosh R. Bhatikar (ARB) *
* Date written : 25nd December 2000 *
* Modification History : *
* Date of modification Reason *
****************************************************************************/
BOOL gShowMenuBack(/*in*/HMENU hMenu, /*in*/CWnd* pWnd)
{
// put the menu back in place if it was removed before
if (hMenu != NULL)
{
// Invalidate before SetMenu since we are going to replace
// the frame's client area anyway
pWnd->Invalidate();
::SetMenu(pWnd->GetSafeHwnd(), hMenu);
return TRUE;
}
return FALSE;
}
相关文章推荐
- [每日练习] write a function to find the key in a m*n matrix, where each line and column is incremental
- The certificate used to sign “AppName” has either expired or has been revoked. An updated certificate is required to sign and install the application解决
- 93 The ORACLE_SID environment variable is set to +ASM. ASMLIB is not used in the configuration. You
- android Failed to install *.apk on device 'emulator-5554' timeout 或者 the user data image is used解决办法
- The function size must be used with a prefix when a default namespace is not specified
- The identity used to sign the executable is no longer valid
- centos 6.3 使用 vnc xrdp 远程登陆 不断弹出对话框“ Authentication is required to set the network proxy used for downloading packages ”
- the identity used to sign the executable is no longer valid.解决方法
- PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone
- Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive
- Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone sett
- This is probably a good time to review the order in which SELECT statement clauses are to be specified. Table 10.2 lists all the clauses we have learned thus far, in the order they must be used.
- CoreDataErrorThe model used to open the store is incompatible with the one used to create the store
- XCode RUN时出现The identity used to sign the executable is no longer valid
- Adobe Reader X:The program used to create this object is AcroExch
- The identity used to sign the executable is no longer valid
- The identity used to sign the executable is no longer valid
- xcode在真机调试的时候出现"The identity used to sign the executable is no longer valid"
- the identity used to sign the executable is no longer valid.的解决方法
- the `gets' function is dangerous and should not be used.