Mega Code Archive

 
Categories / Delphi / Examples
 

Taskbar hides windows- size of taskbar

Sometimes the taskbar covers a part of your application window and you would like to avoid that. The following procedure shows how to retrieve the size of the taskbar ('tray window'); the key information is the internal window's classname Shell_TrayWnd: procedure TForm1.Button1Click(Sender: TObject); var Tasklist : HWnd; Bordered : TRect; begin Tasklist := FindWindow('Shell_TrayWnd', nil); GetWindowRect(Tasklist, Bordered); Label1.Caption := 'Left: ' + IntToStr(Bordered.Left); Label2.Caption := 'Right: ' + IntToStr(Bordered.Right); Label3.Caption := 'Top: ' + IntToStr(Bordered.Top); Label4.Caption := 'Bottom: ' + IntToStr(Bordered.Bottom); end;