CEF Simulate Mousedown and Keysend

别说谁变了你拦得住时间么 提交于 2019-11-29 15:28:57

问题


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); 

or

MouseEvent a = new MouseEvent();
a.Modifiers = CefEventFlags.LeftMouseButton;
a.X = 500;
a.Y = 500;

or

managedCefBrowserAdapter.SendKeyEvent(0, 0, 0);

But nothing works.


回答1:


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);


来源:https://stackoverflow.com/questions/31135070/cef-simulate-mousedown-and-keysend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!