CEF Simulate Mousedown and Keysend

2019-02-11 01:34发布

问题:

i want to use the CEF to control a Flash Applikation, therefore i need a simulated MouseDown and KeySend Execute without Javascript. I searched very much but i didn't find a snipped. Just some tries (with offscreen):

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

Nothing works for me :(, thank u for help :)

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