unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
function MyProc(Handle: hwnd; lParam: LParam): boolean; stdcall;
var
s: string;
begin
SetLength(s, 100);
GetClassName(Handle, PChar(s), 100);
if Pos('EDIT', UpperCase(s)) > 0 then
begin
SetLength(s, 200);
SendMessage(Handle, WM_GETTEXT, 200, LongInt(S));
Form1.Memo1.Text := s;
end;
Result := True;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
h: THandle;
begin
h := FindWindow(PChar('Notepad'), nil);
EnumChildWindows(h, @MyProc, 0);
end;
end.
已经有人贴过了,我也贴过,