var
Form1: TForm1;
implementation
{$R *.DFM}
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 // ComboBoxEx32可以改成Edit.
begin
SendMessage(h,WM_GETTEXT,255,LongInt(@url));
SendMessage(h,WM_SETTEXT,255,longint(pchar('http://www.sohu.com')));
Sendmessage(h,WM_KEYDOWN,VK_Return,1);
//你说的是加这一句吗??不行啊。 改成Edit就可以,相当于在地址栏敲回车
form1.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 TForm1.findbuttonClick(Sender: TObject);
begin
listbox1.Clear;
Enumwindows(@callbackproc,0);
end;
end.