最近用delphi做一个可以后台循环自动提交网页的程序,现在网页能够自动提交。 现在的问题是如何让webbrowser循环提交  1、当我点击一个按钮webbroweser自动提交网页内数据。但是一会就返回一个"提交成功"的对话框。我现在要怎么把这个对话框屏蔽掉并。在提交成功后继续进入另一个网页,继续提交数据。如此的循环下去

解决方案 »

  1.   

    推荐使用idhttp,如果一定要用webbrowser,那就需要处理对话框窗口,可以用EnumWindows,或FindWindows之类的
    函数找到对话框,然后发消息关闭它。
      

  2.   

    用一个第三方的WEBBROWSE,里面有个事件,指定一条语句,好像是RESULT:=FALSE,就搞定了。
      

  3.   

    用IdHTTP就可以了,或者ICS里面的CliHTTP,如果网站是HTTPS类型的,要下载OpenSSL支持库,Indy和ICS都支持
      

  4.   


    function TForm1.wbShowMessage(HWND: Cardinal; lpstrText,
      lpstrCaption: PWideChar; dwType: Integer; lpstrHelpFile: PWideChar;
      dwHelpContext: Integer; var plResult: Integer): HRESULT;
    begin
       Result   :=   S_OK;
    end;
      

  5.   

    procedure   TForm1.WMActivate(var   Msg:   TWMActivate);  
    var
    S: String;
    wnd: HWND;
    I: Integer;
    HButton: THandle;
    changdu_autodh : integer;  
    begin
      If Msg.Active = 0 then
          begin
              wnd :=  Msg.ActiveWindow;
              I := GetWindowTextLength(wnd);
              SetLength(S,I + 1);
              GetWindowText(Wnd,PChar(S),I + 1);
              If   Pos('Internet Explorer',S) > 0 then  //Internet Explorer ?
                     Begin
                     HButton := FindWindowEx(wnd,0,'Button','确定');   //确定?
                     SetForegroundWindow(HButton);
                     if   HButton<>0   then
                     begin
                     sendmessage(HButton,BM_CLICK,0,0);
                     changdu_autodh:=  length(RichEdit1.Text);
     
                     end;
                  End;      end;
      end;
      

  6.   

    idhttp实现起来比较容易方便。