urlList:TStringList;procedure TMainForm.GetUrlList(var UrlList: TStringList); var sw:IShellWindows; i,count:Integer; web:IWebBrowser2; str:WideString; begin UrlList.Clear; try sw:=CoShellWindows.Create; count:=sw.Count; except sw:=nil; count:=0; end; if count=0 then exit; for i:=0 to count-1 do begin try web:=sw.Item(i) as IWebBrowser2; str:=web.LocationURL; except str:=''; end; if(Pos('file://',LowerCase(str))=0)and(str<>'')then UrlList.Add(str); end; end;
var
sw:IShellWindows;
i,count:Integer;
web:IWebBrowser2;
str:WideString;
begin
UrlList.Clear;
try sw:=CoShellWindows.Create;
count:=sw.Count;
except
sw:=nil;
count:=0;
end;
if count=0 then exit;
for i:=0 to count-1 do
begin
try web:=sw.Item(i) as IWebBrowser2;
str:=web.LocationURL;
except
str:='';
end;
if(Pos('file://',LowerCase(str))=0)and(str<>'')then
UrlList.Add(str);
end;
end;