在 C# 中用 Webbrowser中打开 http://web2.qq.com/
在左面会有QQ的企鹅图标,但是我用了很多方法,都无法让 Webbrowser 去模拟点击那个QQ企鹅图标,来打开QQ登陆窗口,请教高手,100分相赠,谢谢大家了。

解决方案 »

  1.   

    参考:http://www.cnblogs.com/Gemgin/archive/2013/06/13/3136328.html
      

  2.   

    也可以参考这个博客:http://www.cnblogs.com/wuhuacong/
      

  3.   

     [DllImport("User32.Dll")]
            public static extern long SetCursorPos(int x, int y);
            [DllImport("user32.dll")]
            public extern static void mouse_event(int dwFlags, int dx, int dy, int dwData, IntPtr dwExtraInfo);
          
            private void button2_Click(object sender, EventArgs e)
            {
                HtmlElement kk = webBrowser3.Document.GetElementById("alloy_icon_app_50_3");
                Rectangle rect = kk.OffsetRectangle;
                Point p = new Point(rect.Left + 40, rect.Top + 110);
                p = this.PointToScreen(p);
                SetCursorPos(p.X, p.Y);
                mouse_event(6, 0, 0, 0, IntPtr.Zero);
            }
      

  4.   

    可以在页面加载后直接调用它的应用:
    webBrowser1.Document.InvokeScript("eval", new object[] { "qqweb.portal.runApp(50)" });