友
友美子
Unregistered / Unconfirmed
GUEST, unregistred user!
以下代码我在xp+ie7下面只可以获取标题,但无法获取网址
========================================
获取IE窗口的标题及网址
作者:未知 文章来源:网络 点击数: 更新时间:2005-11-14
function getieaddress(a:thandle):string;
var
myiestr:array[0..1023] of char;
myWorkerW,myReBarWindow32,myieaddress:thandle;
begin
myWorkerW:=FindWindowEx(a,0,'WorkerW',nil);
if myWorkerW=0 then
begin
result:='';
exit;
end;
myReBarWindow32:=FindWindowEx(myWorkerW,0,'ReBarWindow32',nil);
if myReBarWindow32=0 then
begin
result:='';
exit;
end;
myieaddress:=FindWindowEx(myReBarWindow32,0,'ComboBoxEx32',nil);
if myieaddress=0 then
begin
result:='';
exit;
end;
SendMessage(myieaddress,WM_GetText,1023,Integer(@myiestr[0]));
if myiestr<>'' then result:='网页地址:'+myiestr
else result:='';
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
myForewindow:integer;
lpszClassName,lpszWindowText:array[0..254] of char;
begin
myForewindow:=GetForegroundwindow;
GetWindowText(myForewindow,lpszWindowText,254); //得到窗口标题
GetClassName(myForewindow,lpszClassName,254); //得到窗口类名。
if lpszClassName='IEFrame' then
begin
memo1.Lines.Add(datetimetostr(now)+#13+#10+'当前正在工作的IE窗口标题是:'+lpszWindowText);
memo1.Lines.Add(getieaddress(myForewindow));
end;
end;
========================================
获取IE窗口的标题及网址
作者:未知 文章来源:网络 点击数: 更新时间:2005-11-14
function getieaddress(a:thandle):string;
var
myiestr:array[0..1023] of char;
myWorkerW,myReBarWindow32,myieaddress:thandle;
begin
myWorkerW:=FindWindowEx(a,0,'WorkerW',nil);
if myWorkerW=0 then
begin
result:='';
exit;
end;
myReBarWindow32:=FindWindowEx(myWorkerW,0,'ReBarWindow32',nil);
if myReBarWindow32=0 then
begin
result:='';
exit;
end;
myieaddress:=FindWindowEx(myReBarWindow32,0,'ComboBoxEx32',nil);
if myieaddress=0 then
begin
result:='';
exit;
end;
SendMessage(myieaddress,WM_GetText,1023,Integer(@myiestr[0]));
if myiestr<>'' then result:='网页地址:'+myiestr
else result:='';
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
myForewindow:integer;
lpszClassName,lpszWindowText:array[0..254] of char;
begin
myForewindow:=GetForegroundwindow;
GetWindowText(myForewindow,lpszWindowText,254); //得到窗口标题
GetClassName(myForewindow,lpszClassName,254); //得到窗口类名。
if lpszClassName='IEFrame' then
begin
memo1.Lines.Add(datetimetostr(now)+#13+#10+'当前正在工作的IE窗口标题是:'+lpszWindowText);
memo1.Lines.Add(getieaddress(myForewindow));
end;
end;