Re: Taskbar height with Delphi

Posted by Jenny on May 12, 2005

In Reply to: Get Taskbar height posted by @ntoine on May 03, 2005:

: I'm trying to make an application that shows up, with it's bottom on the taskbar, but I don't know how to get the taskbar's height. The standart height in WinXP is 30, but you can change it.
: I allready found out how to check if the autohide function is on:
: ----------------------------------
: uses
: ShellAPI;

: function IsTaskbarAutoHideOn: Boolean;
: var
: ABData: TAppBarData;
: begin
: ABData.cbSize := SizeOf(ABData);
: Result := (SHAppBarMessage(ABM_GETSTATE, ABData) and ABS_AUTOHIDE) > 0;
: end;
: ----------------------------------
: Does anyone know how to check the height of the taskbar?

You can try this function:

function TaskBarHeight: integer;
var
  hTB: HWND; // taskbar handle
  TBRect: TRect; // taskbar rectangle
begin
  hTB:= FindWindow('Shell_TrayWnd', '');
  if hTB = 0 then
    Result := 0
  else begin
    GetWindowRect(hTB, TBRect);
    Result := TBRect.Bottom - TBRect.Top;
  end;
end;

Greetz,
Jenny