記得要使用 ShellAPI 哦~
參考資料:
http://bdn.borland.com/article/0,1410,26977,00.html
代碼: 選擇全部
procedure Tform1.Button3Click(Sender: TObject);
var
sthandle: HWND;
abd: TAppBarData;
begin
sthandle := FindWindow('Shell_TrayWnd', nil);
if sthandle <> 0 then
begin
abd.cbSize := SizeOf(abd);
if SHAppBarMessage(ABM_GETTASKBARPOS, abd) = 0 then
raise Exception.Create('SHAppBarMessage returned false when trying to find the Task Bar''s position');
// 0 for left, 1 for top, 2 for right, 3 for bottom
case abd.uEdge of
0: ShowMessage('AppBar is on left side');
1: ShowMessage('AppBar is on top side');
2: ShowMessage('AppBar is on right side');
3: ShowMessage('AppBar is on bottom side');
else
ShowMessage('AppBar is unknown position!');
end;
end;
end;