CE隱藏和顯示系統工作列
HWND hWndInputPanel = NULL;
HWND hWndTaskBar = NULL;
HWND hWndSipButton = NULL;
RECT rtDesktop;
RECT rtNewDesktop;
//RECT rtInputPanel;
//RECT rtSipButton;
RECT rtTaskBar;
//初始化工作列,獲取工作列視窗引數
int InitFullScreen (void)
{
int Result = 0;
__try
{
if (SystemParametersInfo(SPI_GETWORKAREA, 0, &rtDesktop, NULL) == 1)
{
// Successful obtain the system working area (Desktop)
SetRect(&rtNewDesktop, 0, 0, CEP_SCREEN_WIDTH, CEP_SCREEN_HEIGHT);
// Change system setting
SystemParametersInfo(SPI_SETWORKAREA, 0, &rtNewDesktop, SPIF_UPDATEINIFILE);
}
hWndTaskBar = FindWindow(TEXT(“HHTaskBar”), NULL);
// Checking…
if (hWndTaskBar != NULL)
{
// Get the original taskbar window size
GetWindowRect(hWndTaskBar, &rtTaskBar);
if (rtTaskBar.top >= CEP_SCREEN_HEIGHT)
{
rtTaskBar.top = CEP_SCREEN_HEIGHT - (rtTaskBar.bottom-rtTaskBar.top);
rtTaskBar.bottom = CEP_SCREEN_HEIGHT;
}
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
// PUT YOUR ERROR LOG CODING HERE
// Set return value
Result = 1;
}
return Result;
}
//顯隱工作列,隱藏時將工作列視窗移到螢幕外面,顯示時再移入
int DoFullScreen (bool mode)
{
int Result = 0;
__try
{
if (mode)
{
// Update window working area size
SystemParametersInfo(SPI_SETWORKAREA, 0, &rtNewDesktop, SPIF_UPDATEINIFILE);
if (NULL != hWndTaskBar)
{
// Hide the TaskBar
MoveWindow(hWndTaskBar,
0,
rtNewDesktop.bottom,
rtTaskBar.right - rtTaskBar.left,
rtTaskBar.bottom - rtTaskBar.top,
false);
}
}
else
{
// Update window working area size
SystemParametersInfo(SPI_SETWORKAREA, 0, &rtDesktop, SPIF_UPDATEINIFILE);
// Restore the TaskBar
if (NULL != hWndTaskBar)
{
MoveWindow(hWndTaskBar,
rtTaskBar.left,
rtTaskBar.top,
rtTaskBar.right - rtTaskBar.left,
rtTaskBar.bottom - rtTaskBar.top,
false);
}
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
// PUT YOUR ERROR LOG CODING HERE
// Set return value
Result = 1;
}
return Result;
}
如非註明轉載, 均為原創. 本站遵循知識共享CC協議,轉載請註明來源