以下程序为获取所有文字编辑框的文本的代码(包括IE地址栏的地址)窗体设置:1个Button_OK,1个ListBox2.procedure TForm1.Button_OKClick(Sender: TObject);
var
  HWND: THandle;
  ClassName: array [0..254] of char;
  buf: String;  function GetText(hWndNow:THandle):String;
var
  buf:Array of Char;
  t:String;
  i, hLength:Integer;
begin
  hLength:=SendMessage(hWndNow,WM_GETTEXTLENGTH,0,0);
  if hLength>0 then
  begin
    SetLength(buf,hLength+1);
    SendMessage(hWndNow,WM_GETTEXT,hLength+1,LPARAM(buf));
    for i:=0 to Length(buf) do
      t:=t+buf[i];    GetText:=t;
  end
  else
    GetText:='';
end;begin
  ListBox2.Clear; 
  for HWND:= 1 to 65535 do
  begin
    GetClassName(HWND, @ClassName, 255);
    if (ClassName[0] = 'E') and (ClassName[1] = 'd') and
      (ClassName[2] = 'i') and (ClassName[3] = 't') and
      (ClassName[4] = #0) then
    begin
      buf:= GetText(HWND);
      if buf <> '' then
      begin
        //ListBox1.Items.Add(IntToStr(HWND));  //这里的HWND就是Edit得句柄
        ListBox2.Items.Add(buf);            //buf就是Edit中的内容
      end;
    end;
  end;
end;