本帖最后由 suleil1 于 2010-04-14 16:15:18 编辑

解决方案 »

  1.   

    使用AutoHotKey,就是热键,只要弹出这个窗体就自动把它点掉
      

  2.   

    以前lihuasoft 曾经发过测试代码,我给你贴出来:function CallBackProc(H, HMainForm: hwnd): Boolean; stdcall;
    var
      hChild : hwnd;
    begin
      Result := True;
      if GetParent(H) = HMainForm then begin //可以在这里进一步判断类名,以免关掉其他弹出窗口
        hChild := FindWindowEx(H, 0, PChar('Button'), PChar('确定'));
        if hChild > 0 then SendMessage(hChild, BM_Click, 0, 0);
      end;
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      EnumWindows(@CallBackProc, Self.Handle);
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      Self.WebBrowser1.Navigate('C:\Documents and Settings\jiaotongju\桌面\test2\test.htm');
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
      Self.Timer1.Enabled := True;//Web页面装载完毕后开启Timer
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      Self.Timer1.Enabled := False;
      Self.Timer1.Interval:= 100;
    end;
    '这是C:\Documents and Settings\jiaotongju\桌面\test2\test.htm的内容
    <html><head>
    <title>test</title>
    </head><body><form method="POST" action="">
    <p><input type="button" value="按钮" name="B1" onclick="alert('关掉我')"></p>
    </form></body></html>
      

  3.   

    试试
    webBrowser1.ScriptErrorsSuppressed = true;
      

  4.   

    if(confirm("确定要删除"))
        alert("我确定后的代码操作");//删除操作
    else
        return ;
      

  5.   

    在弹出对话框后可否发送一个enter呢?
    嘿嘿,没弄过,纯属瞎想
      

  6.   

    在弹出对话框后可否发送一个enter呢?
    嘿嘿,没弄过,纯属瞎想
      

  7.   

    如果屏蔽JS,那么连框都不弹,我就不能提交了。
    还有,输入Enter键也不行SendKey.send("enter")这句根本没执行就卡住了,线程已经阻塞了。
    还有4楼的哥们,你给的代码好像不是C#的吧
      

  8.   

    新建个线程,FindWindow查找弹出的对话框的句柄,然后发送消息WM_CLOSE关闭
      

  9.   


    http://topic.csdn.net/u/20080516/13/6d926aad-3a9d-44ec-a25b-df2e4bdac208.html参考这个用FindWindowEx来找到你这个对话框的句柄,然后SendMessage发送消息
      

  10.   

    using mshtml; 
    using SHDocVw; 
    private void Form1_Load(object sender, EventArgs e) 

    this.webBrowser1.Navigate("http://localhost:28512/test/Default.aspx"); 
    SHDocVw.WebBrowser wb = this.webBrowser1.ActiveXInstance as SHDocVw.WebBrowser; 
    wb.NavigateComplete2 += new SHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(wb_NavigateComplete2); } void wb_NavigateComplete2(object pDisp, ref object URL) 

    mshtml.IHTMLDocument2 doc = (this.webBrowser1.ActiveXInstance as SHDocVw.WebBrowser).Document as mshtml.IHTMLDocument2; 
    doc.parentWindow.execScript("function alert(str){return ''}", "javascript");