下面的代码可以找到另一个程序中PageControls的tab的handle<br>function EnumChildProc(hwnd: HWND; lParam: LPARAM): BOOL; stdcall;<br>var<br>wtext: Array[0..255] of Char;<br>begin<br>Getclassname(hwnd, @wtext, 255);<br>if SameText(wtext, 'TTabSheet') then <br>begin<br> getwindowtext(hwnd, @wtext, 255);<br> showmessage(strpas(wtext));<br>end;<br>Result := True;<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>whandle:hwnd;<br>begin<br> whandle:=findwindow(nil,'formmain'); <br> if whandle=0 then<br> showmessage('window not find')<br> else<br> EnumChildWindows(whandle,@EnumChildProc,0);<br>end;