private void BrowserLoaded(object sender, EventArgs args) { IntPtr folder = WPTool.GetFolder(); hook.OnMouseActivity += delegate(object hs, MouseEventArgs he) { WPTool.WinRef.GetCursorPos(out WPTool.WinRef.CPoint p); IntPtr cursor = WPTool.WinRef.WindowFromPoint(p); var host = browser.GetBrowser().GetHost(); switch (he.Button) { case MouseButtons.Left: if (cursor == folder) { host.SendMouseClickEvent(new CefSharp.MouseEvent(he.X, he.Y, CefSharp.CefEventFlags.None), CefSharp.MouseButtonType.Left, false, he.Clicks); Thread.Sleep(3); host.SendMouseClickEvent(new CefSharp.MouseEvent(he.X, he.Y, CefSharp.CefEventFlags.None), CefSharp.MouseButtonType.Left, true, he.Clicks); } break; case MouseButtons.Right: host.SendMouseClickEvent(new CefSharp.MouseEvent(he.X, he.Y, CefSharp.CefEventFlags.None), CefSharp.MouseButtonType.Right, false, he.Clicks); Thread.Sleep(3); host.SendMouseClickEvent(new CefSharp.MouseEvent(he.X, he.Y, CefSharp.CefEventFlags.None), CefSharp.MouseButtonType.Right, true, he.Clicks); break; case MouseButtons.None: if (cursor == folder) { host.SendMouseMoveEvent(new CefSharp.MouseEvent(he.X, he.Y, CefSharp.CefEventFlags.None), false); } break; } }; }
private void Window_Loaded(object sender, RoutedEventArgs e) { WPTool.WallPaper(this); browser.Loaded += BrowserLoaded; }