I'm a Delphi programmer, and about six months ago, I noticed a strange error in both Delphi and several other applications, such as Snagit, that would freeze.
To identify the cause, I disabled several applications until I realized that "Startallback windows 11" was the culprit. It also freezes when I access the settings and doesn't respond.
The Delphi code I use to locate the taskbar's position is this one, which returns without a position after the error.
function GetTaskBarSize: Integer;
Var Data: TAppBarData;
Begin
Result := 0;
Data.cbSize := SizeOf(TAppBarData);
If SHAppBarMessage(ABM_GETTASKBARPOS, Data) = 1 Then
Result := Data.rc.Bottom - Data.rc.Top;
end;
function GetTaskBarAlignment: TAlign;
var
Data: TAppBarData;
ScrW, ScrH: Integer;
begin
Result := alNone;
Data.cbSize := SizeOf(TAppBarData);
ScrW := Screen.Width;
ScrH := Screen.Height;
if SHAppBarMessage(ABM_GETTASKBARPOS, Data) = 1 then Begin
if (Data.rc.Top > ScrH div 2) and (Data.rc.Right >= ScrW) then
Result := alBottom
else
if (Data.rc.Top < ScrH div 2) and (Data.rc.Bottom <= ScrW div 2) then
Result := alTop
else
if (Data.rc.Left < ScrW div 2) and (Data.rc.Top <= 0) then
Result := alLeft
else
Result := alRight;
End;
end;