IShellWindow

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
查看
439
import
I
I
回复
0
查看
466
import
I
I
回复
0
查看
697
import
I
I
回复
0
查看
614
import
I
顶部