首页  编辑  

刷新所有的IE窗口

Tags: /超级猛料/OS.操作系统/IE.扩展/   Date Created:

刷新所有的IE窗口

http://www.swissdelphicenter.ch/torry/showcode.php?id=2056

Refresh all Internet Explorer Windows?

Author: Thomas Stutz  

uses

MSHTML_TLB, SHDocVw_TLB;

procedure TForm1.Button1Click(Sender: TObject);

var

ShellWindow: IShellWindows;

WB: IWebbrowser2;

spDisp: IDispatch;

IDoc1: IHTMLDocument2;

k: Integer;

begin

ShellWindow := CoShellWindows.Create;

for k := 0 to ShellWindow.Count do

begin

  spDisp := ShellWindow.Item(k);

  if spDisp = nil then Continue;

  spDisp.QueryInterface(iWebBrowser2, WB);

  if WB <> nil then

  begin

    WB.Document.QueryInterface(IHTMLDocument2, iDoc1);

    if iDoc1 <> nil then

    begin

      WB := ShellWindow.Item(k) as IWebbrowser2;

      WB.Refresh;

    end;

  end;

end;

end;