我想编个程序可以自动向网页表单里发字符(100分)

猪头

Unregistered / Unconfirmed
GUEST, unregistred user!
我想编个程序可以自动向网页表单里发字符(网页含frame结构),<br>可是用findwindow和findwindowex做不出来<br>谁有好办法,给出完整程序的我出150分!<br>
 
http://www.delphibbs.com/delphibbs/dispq.asp?lid=551816<br><br>dana的程序<br><br>uses<br>&nbsp; SHDocVw,MSHTML;<br><br>procedure TForm1.Button1Click(Sender:TObject);<br>var<br>&nbsp; ShellWindow: IShellWindows;<br>&nbsp; nCount: integer;<br>&nbsp; spDisp: IDispatch;<br>&nbsp; i,j,X: integer;<br>&nbsp; vi: OleVariant;<br>&nbsp; IE1: IWebBrowser2;<br>&nbsp; IDoc1: IHTMLDocument2;<br>&nbsp; iELC &nbsp;: IHTMLElementCollection ;<br>&nbsp; S,S2 : string;<br>&nbsp; HtmlInputEle : IHTMLInputElement;<br>&nbsp; HtmlSelEle &nbsp; : IHTMLSelectElement;<br>begin<br>&nbsp; ShellWindow := CoShellWindows.Create;<br>&nbsp; nCount := ShellWindow.Count;<br><br>&nbsp; for i := 0 to nCount - 1 do<br>&nbsp; begin<br>&nbsp; &nbsp; vi := i;<br>&nbsp; &nbsp; spDisp := ShellWindow.Item(vi);<br>&nbsp; &nbsp; if spDisp = nil then continue;<br>&nbsp; &nbsp; spDisp.QueryInterface( iWebBrowser2, IE1 );<br>&nbsp; &nbsp; if IE1 &lt;&gt; nil then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; IE1.Document.QueryInterface(IHTMLDocument2,iDoc1);<br>&nbsp; &nbsp; &nbsp; if iDoc1 &lt;&gt; nil then<br>&nbsp; &nbsp; &nbsp; begin<br><br>&nbsp; &nbsp; &nbsp; &nbsp; ielc:=idoc1.Get_all;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; for j:=0 to ielc.length-1 do<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Application.ProcessMessages;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spDisp := ielc.item(J, 0);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if SUCCEEDED(spDisp.QueryInterface(IHTMLInputElement ,HtmlInputEle))then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with HtmlInputEle do<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; S2:=Type_;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; S2:=UpperCase(S2);<br>//我把所有的input都填上 try , checkbox 都打勾<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (StrComp(PChar(S2),'TEXT')=0) or (StrComp(PChar(S2),'PASSWORD')=0) then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value :='try' //S:=S+#9+Value<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if StrComp(PChar(S2),'CHECKBOX')=0 then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; checked := True;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if SUCCEEDED(spDisp.QueryInterface(IHTMLselectelement ,HtmlSelEle))then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; with HtmlSelEle, Memo1.Lines do<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; S:=S+#9+IntToStr(selectedIndex+1); &nbsp;//这个是获取数据了<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; end; &nbsp;//END FOR<br>&nbsp; &nbsp; &nbsp; &nbsp; Memo2.Lines.Add(S);<br>&nbsp; &nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br><br>附:打开一个网页,如www.163.net试试看
 
影子你提供的程序我试过了<br>不过对于包含在frame结构中的表单不起作用<br>还有访问frame的方法吗
 
顶部