一个刷屏软件的原理:
procedure TForm1.Button1Click(Sender:TObject);
var
sw:IShellWindows;
n:integer;
disp:IDispatch;
i:integer;
vi:OleVariant;
ie1:IWebBrowser2;
idoc1:IHTMLDocument2;
begin
sw:=CoShellWindows.Create;
n:=sw.count;
for i:=0 to n-1 do
begin
vi:=i;
disp:=sw.item(vi);
disp.QueryInterface(IWebBrowser2,ie1);
if ie1 <> nil then
begin
memo1.lines.add'Location:'+ie1.LocationName);
ie1.Document.QueryInterfaceIHTMLDocument2,idoc1);
if idco1 <> nil then
begin
if idoc1.activeitem.isEditText then
begin
idoc1.activeitem.innertext:='Hello,I GOT YOU!';
keybd_event(VK_RETURN,0,0,0); // 送回车
//当然也是可以找到具体的submit按钮的,调用submit好象安全一点。
end;
memo1.lines.add('Title:'+idoc1.Title);
memo1.lines.add('URL:'+idco1.url);
end;
end;
end;
end;