偶是来混分的!!!:P<br>首先给你段程序(别急,慢慢来……还有……),<br>把鼠标放在你要查看的控件上,就会得到句柄和类名!<br>以下抄袭至 卷起千堆雪:<br>===============================================================================<br><br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls, ExtCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Timer1: TTimer;<br> Label1: TLabel;<br> Label2: TLabel;<br> procedure Timer1Timer(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> procedure GetMousePosHwndAndClassName(Sender: TPoint);<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.GetMousePosHwndAndClassName(Sender: TPoint);<br>var<br> hWnd: THandle;<br> aName: Array[0..255] of Char;<br>begin<br> hWnd := WindowFromPoint(Sender);<br> Label1.Caption := 'Handle : ' + IntToStr(hWnd) + #13;<br><br> if Boolean(GetClassName(hWnd, aName, 256)) then<br> Label2.Caption := 'ClassName : ' + string(aName)<br> else<br> Label2.Caption := 'ClassName : not found';<br>end;<br><br>procedure TForm1.Timer1Timer(Sender: TObject);<br>var<br> rPos: TPoint;<br>begin<br> if Boolean(GetCursorPos(rPos)) then<br> GetMousePosHwndAndClassName(rPos);<br>end;<br><br>end.