to 影 子:很感谢你.我已经找到一个窗体上的所有的控件的handle.<br>根据你的提示我做了如下的一个程序已经可以找到窗体上的控件类名,<br>但是还是不知道怎么样找到我想要的控件。<br>------------------------------------------------------------------------<br>unit Unit1;<br>interface<br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br>type<br> TForm1 = class(TForm)<br> Memo1: TMemo;<br> Label1: TLabel;<br> Edit1: TEdit;<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br> function EnumChildWndProc(AhWnd:HWnd;<br> AlParam:lParam):boolean;stdcall;<br><br>implementation<br><br>{$R *.dfm}<br>function EnumChildWndProc(AhWnd:HWnd;<br> AlParam:lParam):boolean;stdcall;<br>var<br> WndClassName: array[0..254] of Char;<br>begin<br> GetClassName(AhWnd,wndClassName,254);<br> with form1.memo1 do<br> begin<br> lines.add( string(wndClassName));<br> lines.add('-------');<br> end;<br> result:=true;<br>end;<br><br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> hWnd:LongInt;<br>begin<br> memo1.Lines.Clear;<br> Memo1.Lines.Add(Edit1.Text+' 有如下控件类名称');<br> hWnd:=FindWindow(nil,pchar(Edit1.Text));<br> if hWnd<>0 then<br> begin<br> EnumChildWindows(hWnd,@EnumChildWndProc,0);<br> end;<br>end;<br>end.<br>------------------------------------------------------------------<br><br>补充: <br>比如 <br>程序1: <br> 窗体标题: 职工信息 <br> 窗体上的控件: DBZGBH :TDBEdit <br> DBZGXM :TDBEdit <br> ..... <br>现在编写程序2,要求得到DBZGBH的handle. <br> <br>