procedure TForm1.Button1Click(Sender: TObject);
var
ShellWindow: IShellWindows;
ie :IWebBrowser2;
i,j : Integer;
V,vInput : OleVariant;
sp:IDispatch;
idoc:IHTMLDocument2;
aInput :IHTMLInputButtonElement;
begin
ShellWindow := CoShellWindows.Create;
for i:=0 to ShellWindow.Count-1 do
begin
V := i;
sp := ShellWindow.Item(V);
sp.QueryInterface(IWebBrowser2,ie);
if ie<>nil then
begin
if ie.LocationURL='http://www.sohu.com' then
begin
ie.Document.QueryInterface(IHTMLDocument2,idoc);
if idoc<>nil then
begin
for j:=0 to idoc.all.Length-1 do
begin
sp := idoc.all.item(j,varEmpty);