1.如何获得IE当前窗口的URL
uses SHDocVw,MSHTML;
procedure GetIEUrl(w:longint):String;
var i:integer;
ShellWindow: IShellWindows;
IE:IWebBrowser2;
IDoc:IHTMLDocument2;
spDisp:IDispatch;
v:OLEVariant;
begin
ShellWindow:=CoShellWindows.Create;
for i:=0 to ShellWindow.Count-1 do
begin
v:=i;
spDisp:=ShellWindow.Item(v);
spDisp.QueryInterface(IWEBBROWSER2,IE);
if IE=nil then continue;
if IE.Get_HWND<>w then continue;
IDoc:=IE.Document as IHTMLDocument2;
if iDoc=nil then continue;
Result:=iDoc.url;
break;
end;
end;
w:为当前IE窗口的句柄。