DELPHI 怎么控制IE浏览器.自动填表.提交.之类的..急求.麻烦帮帮忙!~

解决方案 »

  1.   

    !_!  这两种都不行..就是要控制IE浏览器..不要用D里面的控件
      

  2.   

    webbrowser或者直接使用idhttp
    都可以做到自动填表.提交
    干嘛非得直接控制IE呢
    外挂控制ie,麻烦还不稳定
      

  3.   

    控制浏览器?控制控制浏览器的打开、关闭及输入的URL?
      

  4.   

    自動填表
    uses   MSHTML; procedure   TForm1.Button1Click(Sender:   TObject); 
    var 
        vHTMLDocument:   IHTMLDocument2; 
        vHTMLElementCollection:   IHTMLElementCollection; 
        vHTMLInputElement:   IHTMLInputElement; 
        vHTMLSelectElement:   IHTMLSelectElement; 
    //     vHTMLFormElement:   IHTMLFormElement; 
    begin 
        vHTMLDocument   :=   WebBrowser1.Document   as   IHTMLDocument2; 
        vHTMLElementCollection   :=   vHTMLDocument.all; 
        vHTMLInputElement   :=   vHTMLElementCollection.item( 'text_name ',   0)   as   IHTMLInputElement; 
        if   Assigned(vHTMLInputElement)   then 
            vHTMLInputElement.value   :=   '自动填表 '; 
        vHTMLSelectElement   :=   vHTMLElementCollection.item( 'select_name ',   0)   as   IHTMLSelectElement; 
        if   Assigned(vHTMLSelectElement)   then 
            vHTMLSelectElement.selectedIndex   :=   1; 
    //     vHTMLFormElement   :=   vHTMLElementCollection.item( 'form1 ',   0)   as   IHTMLFormElement; 
    //     if   Assigned(vHTMLFormElement)   then 
    //         vHTMLFormElement.submit; 
    end; 
      

  5.   

    提交可以使用clientsocket,先截获你提交表单的包信息,然后构造http头
    //Http头信息 
    sends:='POST /Expert/reply.asp HTTP/1.1'+#13#10; 
    sends:=sends+'Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*'+#13#10; 
    sends:=sends+'Accept-Language: zh-cn'+#13#10; 
    sends:=sends+'Content-Type: application/x-www-form-urlencoded'+#13#10; 
    sends:=sends+'Accept-Encoding: gzip, deflate'+#13#10; 
    sends:=sends+'User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)'+#13#10; 
    sends:=sends+'Host: expert.csdn.net'+#13#10; 
    sends:=sends+'Cache-Control: no-cache'+#13+#10; 
    //构造Cookie信息 
    if edit1.text<>'' then 
    begin 
    url.InputString :=trim(edit1.Text); 
    sendp:='username='+url.Encode ; 
    sendc:='csdnname='+url.Encode ; 
    end; 
    if edit2.text<>'' then 
    begin 
    url.InputString :=trim(edit2.Text); 
    sendp:=sendp+';userid='+url.Encode; 
    sendc:=sendc+'&csdnpassword='+url.Encode ; 
    end; 
    if edit3.text<>'' then 
    begin 
    url.InputString :=trim(edit3.Text); 
    sendp:=sendp+';aszx='+url.Encode; 
    end; 
    sends:=sends+'Cookie: '+sendp+#13+#10; 
    //发送的内容 
    url.inputstring:=trim(edit4.text); 
    sendc:=sendc+'&Topicid='+url.Encode; 
    url.InputString :=trim(memo1.Text); 
    sendc:=sendc+'&ReplyContent='+url.Encode; 
    sendc:=sendc+'&xmlReply=aaaaa'; 
    sends:=sends+'Content-Length: '+inttostr(length(sendc))+#13#10; 
    sends:=sends+'Connection: Keep-Alive'+#13+#10+#13#10 +sendc; 
    memo2.Lines.Clear; 
    memo2.Lines.Add(sends); 
    clientsocket1.Socket.SendText(sends);  /////////////////////////////////////////////////////////////////////////////////////
    提交帖子截获的包信息: Topicid=1761293&xmlReply=aaaaa&csdnname=&csdnpassword=&ReplyContent=test10.104.9.30(2807)->10.104.9.30(80) 
    POST /Expert/reply.asp HTTP/1.1 
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */* 
    Referer: http://expert.csdn.net/Expert/xsl/Reply_Xml.asp?Topicid=1761293 
    Accept-Language: zh-cn 
    Content-Type: application/x-www-form-urlencoded 
    Accept-Encoding: gzip, deflate 
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) 
    Host: expert.csdn.net 
    Content-Length: 72 
    Connection: Keep-Alive 
    Cache-Control: no-cache 
    Cookie: ASPSESSIONIDQQQTRARD=DNLFEPPAAODHIOGCMLPPIFKP; room=0; username=dashi888; speaknum=0; speaktime=2003%2D5%2D14+16%3A48%3A06; adminok=True; userid=487815; info1=0; remenber=0; mid=476831; m%5Ftype=1; aszx=0a727a0323ec0c60e5c113526be5ba02
      

  6.   

    楼主在网上搜下iwebbrowser2接口,就是专门解决你这个问题的。
      

  7.   

    var
       IE: Variant;
    begin
        IE := CreateOleObject('InternetExplorer.Application');
        IE.Visible := true; //可见
        IE.Navigate(URL);
      

  8.   

    用wpe工具,你在网页提交,然后抓包看看提交内容,然后用idhttp去模拟提交
      

  9.   

    rug 在webbrowser上也可以,但是限制比较多,比如有的是安全组件,用javascript时不行的,需要遍历组件然后发送字符消息,有的还无法找到
      

  10.   

    楼主想要的是控制已经打开的IE浏览器,控制里面的操作吧,那应是findwindow,sendmessage一系列的操作吧,应该很复杂
      

  11.   

    已经说得很明白了,此人不想用Delphi的控件,估计就是个整木马的,很在意编译出的体积