Mega Code Archive

 
Categories / Delphi / API
 

How to get the location of the task bar

unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,shellapi, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var AB : TAppBarData; sPos:string; begin AB.cbSize := sizeof(AB); SHAppBarMessage(ABM_GETTASKBARPOS, AB); case AB.uEdge of 0:sPos:='Left'; 1:sPos:='Top'; 2:sPos:='Right'; 3:sPos:='Bottom'; end; ShowMessage('Taskbar is at the '+sPos+' Position.'); end; end.