procedure prShowTaskBar(blShow : Boolean);
var
wndTaskbar : THandle;
hApp, hWinMenuBtn : HWND;
rcApp, rcWork : TRect;
begin
wndTaskbar := FindWindow('
Shell_TrayWnd',
nil);
If (wndTaskbar <> 0)
Then
Begin
If (blShow)
Then
Begin
//Taskbar
EnableWindow(wndTaskbar, True);
ShowWindow(wndTaskbar, SW_SHOW);
//Windows Menu Button
hWinMenuBtn := FindWindowEx(GetDesktopWindow, 0, '
Button',
nil);
ShowWindow(hWinMenuBtn, 1);
Windows.SetParent(hWinMenuBtn, wndTaskbar);
//prepare a default fullscreen workarea
rcWork.Top:=0;
rcWork.Left:=0;
rcWork.Bottom:= GetSystemMetrics(SM_CYSCREEN);
rcWork.Right:= GetSystemMetrics(SM_CXSCREEN);
//get the taskbar handle
hApp := FindWindow('
Shell_TrayWnd', '
');
if hApp <> 0
then begin
//get the size of the taskbar
GetWindowRect(hApp, rcApp);
//cut the workarea to place the taskbar
if rcApp.Right<rcWork.Right
then
rcWork.Left:=rcApp.Right;
if rcApp.Bottom<rcWork.Bottom
then
rcWork.Top:=rcApp.Bottom;
if rcApp.Left>0
then
rcWork.Right:=rcApp.Left;
if rcApp.Top>0
then
rcWork.Bottom:=rcApp.Top;
end;
SystemParametersInfo (SPI_SETWORKAREA, 0, @rcWork, SPIF_SENDCHANGE );
End Else
Begin
//Taskbar
EnableWindow(wndTaskbar, False);
ShowWindow(wndTaskbar, SW_HIDE);
//WindowsButton
hWinMenuBtn := FindWindowEx(FindWindow('
Shell_TrayWnd',
nil), 0, '
Button',
nil);
ShowWindow(hWinMenuBtn, 0);
Windows.SetParent(hWinMenuBtn, 0);
rcWork.Top:=0;
rcWork.Left:=0;
rcWork.Bottom:=GetSystemMetrics(SM_CYSCREEN);
rcWork.Right:=GetSystemMetrics(SM_CXSCREEN);
SystemParametersInfo (SPI_SETWORKAREA, 0, @rcWork, SPIF_SENDCHANGE);
End;
End;
end;