Hide and show taskbar programmatically

Just few lines of code to hide and show Windows taskbar programmatically.

These two examples (two button OnClick events again) show how to hide and unhide Windows taskbar.

procedure TForm1.HideTaskBarClick(Sender: TObject);
var hTaskBar : THandle;

begin
hTaskbar := FindWindow('Shell_TrayWnd', Nil);
ShowWindow(hTaskBar, SW_HIDE);
end;

procedure TForm1.ShowTaskBarClick(Sender: TObject);
var hTaskBar : THandle;
begin
hTaskbar := FindWindow('Shell_TrayWnd', Nil);
ShowWindow(hTaskBar, SW_SHOWNORMAL);
end;

Note, that Start button on your keyboard is still working even if taskbar is deactivated. When you press it, Start-menu appears.

Leave a Reply