CEF模拟鼠标按下和按键发送 [英] CEF Simulate Mousedown and Keysend
本文介绍了CEF模拟鼠标按下和按键发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用CEF来控制Flash应用程序,因此我需要在没有JavaScript的情况下模拟MouseDown和KeySend。我正在使用屏幕外渲染。这是我尝试的方法:
I want to use CEF to control a Flash Application, so I need to simulate MouseDown and KeySend without JavaScript. I am using offscreen rendering. This is what I tried:
managedCefBrowserAdapter.OnMouseButton(
500, 500, 0, true, 2, CefEventFlags.LeftMouseButton);
或
MouseEvent a = new MouseEvent();
a.Modifiers = CefEventFlags.LeftMouseButton;
a.X = 500;
a.Y = 500;
或
managedCefBrowserAdapter.SendKeyEvent(0, 0, 0);
但没有任何效果。
推荐答案
此代码对我有用。在位置0、0(左上角)上单击一次
This code works for me. Clicks once on the position 0, 0 (left-upper corner)
browser.GetBrowser().GetHost().SendMouseClickEvent(0, 0, MouseButtonType.Left, false, 1, CefEventFlags.None);
System.Threading.Thread.Sleep(100);
browser.GetBrowser().GetHost().SendMouseClickEvent(0, 0, MouseButtonType.Left, true, 1, CefEventFlags.None);
这篇关于CEF模拟鼠标按下和按键发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文