IShellWindow

  • 主题发起人 主题发起人 import
  • 开始时间 开始时间
I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
uses shdocvw;
procedure TForm1.Button1Click(Sender: TObject);
var
xwin:IShellWindows;
xweb:iWebbrowser;
i:integer;
begin
xWin:=CoShellWindows.Create;
for i:=0 to xWin.Count-1 do begin
xWeb:=xWin.Item(i) as IWebbrowser;
ListBox1.Items.Add(xWeb.LocationURL);
end;
end;
********************************
var
ShellWindow: IShellWindows;
nCount: integer;
spDisp: IDispatch;
i,j: integer;
vi: OleVariant;
IE1: IWebBrowser2;
IDoc1: IHTMLDocument2;
begin
ShellWindow := CoShellWindows.Create;
nCount := ShellWindow.Count;
for i := 0 to nCount - 1 do
begin
vi := i;
spDisp := ShellWindow.Item(vi);
if spDisp = nil then continue;
spDisp.QueryInterface( iWebBrowser2, IE1 );
if IE1 <> nil then
begin
IE1.Document.QueryInterface(IHTMLDocument2,iDoc1);
if iDoc1 <> nil then
ie1.Quit
end;
end;
end;
 
或者 if IE1 <> nil then ie1.quit ,但者可能会把资源管理器的窗口也关了
 

Similar threads

I
回复
0
查看
475
import
I
S
回复
0
查看
688
SUNSTONE的Delphi笔记
S
S
回复
0
查看
683
SUNSTONE的Delphi笔记
S
后退
顶部