Link to home
Start Free TrialLog in
Avatar of nohj
nohj

asked on

Taskbar height

Using Delphi 3 Pro

How can I get the height of the Windows taskbar so that I can make my forms scale and still leave the task bar visible ?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of kotik
kotik

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kotik
kotik

Tell me if you have difficulties in implementing that.
Avatar of RBertora
I think Kotik is correct, I think that the only way to resize the task bar is by generating the onmouse drag event, you cannot simply set the properties, I tried this but failed.

bert.
Well, here it is:


procedure TForm1.Button1Click(Sender: TObject);
var
  r : TRect;
begin
  SystemParametersInfo(SPI_GETWORKAREA,
                       0,
                       @r,
                       0);
  ShowMessage(IntToStr(r.Bottom - r.Top));
end;

But I think it is easier to set Form1.WindowsState to swMaximized. Now you don't have to worry about anything

Cheers,

Epsylon.
Of course I mean wsMaximized....   :o)
This is a definative way of getting the dimensions of the task bar.

procedure TForm1.Button1Click(Sender: TObject);
var
   wnd:HWND;
   Rct:TRect;
begin
   Wnd:=FindWindow('Shell_TrayWnd', nil);
   GetWindowRect(Wnd,Rct);
   ShowMessage('Rect is:'+#10+#13+
   ' Left='+IntToStr(rct.left)+#10+#13+
   ' Top='+IntToStr(rct.top)+#10+#13+
   ' Bottom='+IntToStr(rct.Bottom)+#10+#13+
   ' Right='+IntToStr(rct.Right));
end;

hi all,

one remark, if allowed,
the taskbar can also be on the side or on the top, not only on the bottom.

meikl
hi again,

an additional remark, if allowed,
eps is right to maximize the form,
this do never hide a standing taskbar.

meikl
Avatar of nohj

ASKER

I used

SystemParametersInfo(SPI_GETWORKAREA,0,@WinRect,0);

WinRect is a TRect;

Thanks
Strange.....