//找到所有已经打开的IE窗口,获得其地址栏的句柄,取出地址栏中所输入
的URL(字符串)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
begin
SendMessage(h,WM_GETTEXT,255,LongInt(@url));
form1.ListBox1.Items.Add(strpas(@url)); //添加一个 ListBox
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.
的URL(字符串)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
begin
SendMessage(h,WM_GETTEXT,255,LongInt(@url));
form1.ListBox1.Items.Add(strpas(@url)); //添加一个 ListBox
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.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货