Function GetURL(H:hwnd;lparam:longint):boolean;stdcall;
var str,url:array [0..254] of char;
begin
    getclassname(h,@str,255);
    if strpas(@str)='ComboBoxEx32' then 
      begin
      SendMessage(h,WM_GETTEXT,255,LongInt(@url));
      fmMain.ListBox1.Items.Add(strpas(@url));
      end;
      result:=true;
  end;function callbackproc(H:HWnd;lparam:longint):Boolean;stdcall;
var str:array [1..255] of char;
begin
  getclassname(h,@str,255);
  if ((strpas(@str)='CabinetWClass') or (strpas(@str)='IEFrame')) then
      begin
        Enumchildwindows(h,@GetURL,0);
      end;
      result:=true;
end;procedure TfmMain.Button3Click(Sender: TObject);
begin
listbox1.Clear;
Enumwindows(@callbackproc,0);
end;

解决方案 »

  1.   

    Function GetURL(H:hwnd;lparam:longint):boolean;stdcall;
    var str,url:array [0..254] of char;
    begin
        getclassname(h,@str,255);
        if strpas(@str)='ComboBoxEx32' then 
          begin
          SendMessage(h,WM_GETTEXT,255,LongInt(@url));
          fmMain.ListBox1.Items.Add(strpas(@url));
          end;
          result:=true;
      end;function callbackproc(H:HWnd;lparam:longint):Boolean;stdcall;
    var str:array [1..255] of char;
    begin
      getclassname(h,@str,255);
      if ((strpas(@str)='CabinetWClass') or (strpas(@str)='IEFrame')) then
          begin
            Enumchildwindows(h,@GetURL,0);
          end;
          result:=true;
    end;procedure TfmMain.Button3Click(Sender: TObject);
    begin
    listbox1.Clear;
    Enumwindows(@callbackproc,0);
    end;
      

  2.   

    我这里有个更简单的
    uses ddeman;
    procedure TForm1.Button1Click(Sender:TObject);
    var
      dde:TDdeClientConv;
    begin
      dde:=TDdeClientConv.Create(self);
      if dde.setLink('Iexpore','www_GetWindowInfo') then
        Edit1.Text:=dde.RequestData('0xffffffff,sURL,sTitle')
      else
        Showmessage('Explore is not running');
    end;
      

  3.   

    果然可以。多谢了。顺便问一句:
    SendMessage 、Enumchildwindows 、Enumwindows的具体功能是什么?
      

  4.   

    to naughtyboy(淘气男孩) :
    你的方法好像不行啊!
      

  5.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls,ddeman;type
      TForm1 = class(TForm)
        Button1: TButton;
        Edit1: TEdit;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    var
      dde:TDDEClientConv;
    begin
        dde:=TDDEClientConv.create(self);
      if dde.setlink('Iexplore','WWW_GetWindowInfo') then
        edit1.text:=dde.requestdata('0xffffffff,sURL,sTitle')
      else
       showmessage('explore is not running');
    end;end.
      

  6.   

    已经解决。多谢各位的回答!
    to  naughtyboy(淘气男孩)  : 
    你的程序不小心把'Iexplore',写成了'Iexpore',怪不得没有成功。