你看看这个吧<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> Memo1: TMemo;<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>implementation<br><br>{$R *.DFM}<br><br>function MyProc(Handle: hwnd; lParam: LParam): boolean; stdcall;<br>var<br> s: string;<br>begin<br> SetLength(s, 100);<br> GetClassName(Handle, PChar(s), 100);<br> if Pos('EDIT', UpperCase(s)) > 0 then<br> begin<br> SetLength(s, 200);<br> SendMessage(Handle, WM_GETTEXT, 200, LongInt(S));<br> Form1.Memo1.Text := s;<br> end;<br> Result := True;<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> h: THandle;<br>begin<br> h := FindWindow(PChar('Notepad'), nil);<br> EnumChildWindows(h, @MyProc, 0);<br>end;<br><br>end.<br>