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> Timer1: TTimer;<br> labHandle: TLabel;<br> labClassName: TLabel;<br> labParent: TLabel;<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> p:TPoint;<br> h:HWND;<br> s:array [0..255] of char;<br>begin<br> GetCursorPos(p);<br> h:=WindowFromPoint(p);<br> GetClassName(h,s,255);<br> labHandle.Caption:=format('0x%x',[h]);<br> labclassname.Caption:=s;<br> h:=GetParent(h);<br> GetClassName(h,s,255);<br> labParent.Caption:=s;<br>end;<br><br>end.<br><br>晕呀,怎么我的代码这么快就被贴上了呀,服!算我没写