Delphi中三种方法获取Windows任务栏的高度

第一种:需要引用Windows单元

ShowMessage(IntToStr(GetSystemMetrics(SM_CYSCREEN)-GetSystemMetrics(SM_CYFULLSCREEN)-GetSystemMetrics(SM_CYCAPTION)));

 

第二种:需要引用Windows单元

function GetSystemTaskBarHeight:Integer; var R:TRect; begin SystemParametersInfo(SPI_GETWORKAREA,0,@R,0); Result:=Screen.Height-R.Bottom; end;

 

第三种:要引用ShellAPI单元

function GetTaskBarRect: Integer; var TBData: TAPPBARDATA; begin TBData.cbSize := SizeOf(TAPPBARDATA); SHAppBarMessage(ABM_GETTASKBARPOS, TBData); Result :=Screen.Height-TBData.rc.Top; end;

你可能感兴趣的:(windows,function,任务,Delphi)