r<br> myhandle : THandle;//本地全局变量<br><br>function EnumerateChildWindows(hWnd: HWND; lParam: LPARAM): BOOL;stdcall;<br>var//枚举函数<br> windowCaption:array[0..254] of Char;<br>begin<br> GetWindowText(Hwnd,WindowCaption,255);<br> if WindowCaption ='确定' then<br> myhandle := hWnd;//找到的按钮句柄<br> Result:=true;<br>end;<br><br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> Hnd : HWnd;<br>begin<br> Hnd := FindWindow( nil,'AAA');//找该程序窗体的句柄<br> if Hnd = 0 then exit;//没找到,退出<br> EnumChildWindows( Hnd, @EnumerateChildWindows, 0 );<br> showmessage(inttostr(myhandle));<br>end;<br>