如何用 Webbrowser 控件来点开 WebQQ 的登陆图标
在左面会有QQ的企鹅图标,但是我用了很多方法,都无法让 Webbrowser 去模拟点击那个QQ企鹅图标,来打开QQ登陆窗口,请教高手,100分相赠,谢谢大家了。
[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); }
可以在页面加载后直接调用它的应用: webBrowser1.Document.InvokeScript("eval", new object[] { "qqweb.portal.runApp(50)" });
|