unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, ExtCtrls, StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Memo1: TMemo;<br> Timer1: TTimer;<br> procedure Timer1Timer(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Timer1Timer(Sender: TObject);<br>var<br> TopHwnd: Hwnd;<br> Rect: TRect;<br>begin<br> TopHwnd := Windows.GetForegroundWindow;<br> Windows.GetWindowRect(TopHwnd, Rect);<br> Memo1.Lines.Add(<br> Format('TopHwnd: %2.2xH, Left: %d, Top: %d, Width: %d, Heigth: %d', [<br> TopHwnd, Rect.Left, Rect.Top, Rect.Right - Rect.Left, Rect.Bottom - Rect.Top ]));<br><br>end;<br><br>end.