用下面的方法可以从所有打开的IE窗口中得到URL地址<br>var<br>ShellWindow: IShellWindows;<br> nCount: integer;<br> spDisp: IDispatch;<br> i: integer;<br> vi: OleVariant;<br> IE1: IWebBrowser2; //IE这里是源代码:<br><br>begin<br> ShellWindow := CoShellWindows.Create;<br> nCount := ShellWindow.Count;<br> for i := 0 to nCount - 1 do<br> begin<br> vi := i;<br> try<br> spDisp := ShellWindow.Item(vi);<br> except exit end;<br> if (spDisp<>nil) then<br> begin<br> try<br> begin<br> spDisp.QueryInterface( iWebBrowser2, IE1 );<br> end<br> except<br> on EAccessViolation do begin exit end;<br> end;<br> if (IE1 <> nil) then<br> begin<br> Log.Lines.add( 'LocationUrl: ' + IE1.Get_LocationURL());<br> end;<br>end;<br>end;<br>