{**
Variante de mon code precedent en utilisant pas l'objet TScreen mais
la fonction GetWindowDesktop.
**}
function GetTaskBarInfos(var tbi : TTaskBarInfo) : boolean;
var TR : TRect;
DR : TRect;
DL,DT,DW,DH : integer;
begin
with tbi do
begin
Handle := FindWindow('Shell_TrayWnd',''); { @User32.FindWindowA }
result := Handle <> INVALID_HANDLE_VALUE;
if result then
begin
result := GetWindowRect(Handle, TR); { @User32.GetWindowRect}
if result then
begin
Left := TR.Left;
Top := TR.Top;
Width := TR.Right - TR.Left;
Height := TR.Bottom - TR.Top;
GetWindowRect(GetDesktopWindow, DR); { @User32.GetDesktopWindow }
DL := DR.Left;
DT := DR.Top;
DW := DR.Right-DR.Left;
DH := DR.Bottom-DR.Top;
if (Left = DL) and (Top = DT) and (Width = DW) and (Height < DH) then
Position := TASKBAR_POSITION_TOP
else
if (Left = DL) and (Top > DT) and (Width = DW) and (Height < DH) then
Position := TASKBAR_POSITION_BOTTOM
else
if (Left = DL) and (Top = DT) and (Width < DW) and (Height = DH) then
Position := TASKBAR_POSITION_LEFT
else
if (Left > DL) and (Top = DT) and (Width < DW) and (Height = DH) then
Position := TASKBAR_POSITION_RIGHT
else
Position := TASKBAR_POSITION_UNKNOW;
end;
end;
end;
end;