internal bool Start(Devices device) { if (Master == IntPtr.Zero || Slaves.Count == 0) { return(false); } switch (device) { case Devices.Keyboard: kbHook.Start(); LogCallback("Keyboard hook started", RichLogTextBox.OutputMode.Log); break; case Devices.Mouse: mHook.Start(); LogCallback("Mouse hook started", RichLogTextBox.OutputMode.Log); break; case Devices.Both: kbHook.Start(); mHook.Start(); LogCallback("Keyboard & Mouse hooks started", RichLogTextBox.OutputMode.Log); break; } return(true); }
private void btnStartStop_Click(object sender, EventArgs e) { hook = new Mouse.Hook(); hook.OnMouseLeftButtonDown += hook_OnMouseLeftButtonDown; hook.OnMouseLeftButtonUp += hook_OnMouseLeftButtonUp; hook.OnMouseXButtonUp += hook_OnMouseXButtonUp; hook.Start(); }
private void btnMouseHook_Click(object sender, EventArgs e) { if (mh.IsRunning) { mh.Stop(); } else { mh.Start(); } Output("Mouse Hook : {0}", mh.IsRunning ? "On" : "Off"); }