站点登录时,如果验证码错误的话,就是弹出 "验证码错误"的JS窗口,c#winform中怎么样来判断有没有弹出这个窗口呢

解决方案 »

  1.   

    这样也许可以,
    动态为webbrowser中的html添加一个自定义的 alert()方法,覆盖原有的 alert()方法,在自定义的alert()方法中,与 c#winform中的代码交互。当其它方法调用 alert()时,就可以在 C#winform中得到消息
      

  2.   

    请看这里!

    自动点掉webbrowser的对话框
    http://topic.csdn.net/u/20100514/18/57ff6e20-986b-464e-8980-33e971ea5853.html?47494#
    WebBrowser 控件应用:弹出新窗体和关闭窗口
    http://www.cnblogs.com/dlwang2002/archive/2007/04/14/713499.html
      

  3.   

    DllImport("User32.dll", EntryPoint = "FindWindow")]
      private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
      [DllImport("User32.dll", EntryPoint = "SendMessage")]
      private static extern int SendMessage(  int hWnd,   // handle to destination window   int Msg,   // message   int wParam, // first message parameter   int lParam // second message parameter   ); 
    int WM_CLOSE = 0x010;
    string lpszParentWindow = "弹出窗体标题";
      int ParenthWnd = (int)FindWindow(null, lpszParentWindow);
      if (ParenthWnd != null)
      {
      //向系统发送关闭窗体指令
      int WndPr = SendMessage(ParenthWnd, WM_CLOSE, 0, 0);
      } 这段代码怎么使用?