B
beyondup
Unregistered / Unconfirmed
GUEST, unregistred user!
var
ShellWindow: IShellWindows;
nCount: integer;
spDisp: IDispatch;
i: integer;
vi: OleVariant;
IE1: IWebBrowser2;
begin
listbox1.clear;
ShellWindow := CoShellWindows.Create;
nCount := ShellWindow.Count;
for i := 0 to nCount - 1 do
begin
vi := i;
try
spDisp := ShellWindow.Item(vi);
except
exit
end;
if (spDisp <> nil) then
begin
try
spDisp.QueryInterface(iWebBrowser2, IE1);
except
on EAccessViolation do
begin
exit
end;
end;
if (IE1 <> nil) then
begin
listbox1.items.add(IE1.Get_LocationURL());
end;
end;
end;
这样虽说能获得地址,但是所有页面的地址。如何才能得到当前页的地址呢?高手指点
ShellWindow: IShellWindows;
nCount: integer;
spDisp: IDispatch;
i: integer;
vi: OleVariant;
IE1: IWebBrowser2;
begin
listbox1.clear;
ShellWindow := CoShellWindows.Create;
nCount := ShellWindow.Count;
for i := 0 to nCount - 1 do
begin
vi := i;
try
spDisp := ShellWindow.Item(vi);
except
exit
end;
if (spDisp <> nil) then
begin
try
spDisp.QueryInterface(iWebBrowser2, IE1);
except
on EAccessViolation do
begin
exit
end;
end;
if (IE1 <> nil) then
begin
listbox1.items.add(IE1.Get_LocationURL());
end;
end;
end;
这样虽说能获得地址,但是所有页面的地址。如何才能得到当前页的地址呢?高手指点