public DarkSwitchApplicationContext() { if (AlreadyRunning()) { Application.Exit(); return; } #region Register hotkey keyBoardManager = new KeyboardHookManager(); keyBoardManager.Start(); keyBoardManager.RegisterHotkey(ModifierKeys.WindowsKey, (int)Keys.OemQuestion, ToggleTheme); #endregion // Save icons lightIcon = Resources.LightIcon; darkIcon = lightIcon.Invert(); var systemUsesLightThemeValue = (int)Registry .GetValue(registryKey, systemUsesLightTheme, 1) != 0; // Initialize Tray Icon var contextMenu = new ContextMenuStrip(); var exit = contextMenu.Items.Add("Exit"); exit.Click += Exit; trayIcon = new NotifyIcon() { Icon = systemUsesLightThemeValue ? lightIcon : darkIcon, ContextMenuStrip = contextMenu, Text = "DarkSwitch", Visible = true, }; trayIcon.MouseClick += new MouseEventHandler(this.Icon_MouseClick); }
public Randomizer() { InitializeComponent(); mainBox.SelectedIndex = 0; keyboardHookManager.RegisterHotkey(0x31, NumKeysPressed); keyboardHookManager.RegisterHotkey(0x32, NumKeysPressed); keyboardHookManager.RegisterHotkey(0x33, NumKeysPressed); keyboardHookManager.RegisterHotkey(0x34, NumKeysPressed); keyboardHookManager.RegisterHotkey(0x35, NumKeysPressed); keyboardHookManager.RegisterHotkey(0x36, NumKeysPressed); keyboardHookManager.RegisterHotkey(0x37, NumKeysPressed); keyboardHookManager.RegisterHotkey(0x38, NumKeysPressed); keyboardHookManager.RegisterHotkey(0x39, NumKeysPressed); keyboardHookManager.Start(); }
public ListenerManager() { InitFsWatcher(); LoadHotkeys(); ReloadHotkeys(); KeyboardHookManager.Start(); InitPeriodicBackupTimer(); SettingsManager.Settings.PropertyChanged += OnSettingsChanged; }
public Form1() { InitializeComponent(); _processor = new LowLevelProcessor(new Sha1HashProvider(), new ExcludingSettings() { Excluded = {} }); _manager = new KeyboardHookManager(); _manager.Start(); }
/// <summary> /// This class should be created and passed into Application.Run( ... ) /// </summary> public CustomApplicationContext() { InitializeContext(); // set the keyhooker var keyboardHookManager = new KeyboardHookManager(); keyboardHookManager.Start(); keyboardHookManager.RegisterHotkey(0x60, () => { Debug.WriteLine("NumPad0 detected"); }); keyboardHookManager.RegisterHotkey(NonInvasiveKeyboardHookLibrary.ModifierKeys.Control | NonInvasiveKeyboardHookLibrary.ModifierKeys.Alt, 0x60, () => { Debug.WriteLine("Ctrl+Alt+NumPad0 detected"); }); }
private void PongForm_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { //this.Hide(); updateFieldTimer.Stop(); notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(1000); keyboardHookManager.Start(); } else if (this.WindowState == FormWindowState.Normal) { updateFieldTimer.Start(); keyboardHookManager.Stop(); notifyIcon1.Visible = false; } }
private void Form1_Load(object sender, EventArgs e) { mus = new MyUserSettings(); numericX.Value = mus.secondX; numericY.Value = mus.secondY; keyboardHookManager.Start(); keyboardHookManager.RegisterHotkey(NonInvasiveKeyboardHookLibrary.ModifierKeys.Alt, 0x60, () => { Debug.WriteLine("Alt+NumPad0 detected"); //click screen SimMouse.Click(MouseButtons.Left, (int)numericX.Value, (int)numericY.Value); //right minus Thread.Sleep(100); //get active app handle IntPtr handle1 = GetForegroundWindow(); //move app ShowWindow(handle1, 1); MoveWindow(handle1, 200, 200, 500, 500, true); //------------------------------------- //click screen SimMouse.Click(MouseButtons.Left, 1780, 0); //left minus Thread.Sleep(100); //get active app handle IntPtr handle2 = GetForegroundWindow(); //move app ShowWindow(handle2, 1); MoveWindow(handle2, 2120, 363, 500, 500, true); ShowWindowAsync(handle1, 3); ShowWindowAsync(handle2, 3); /* * // left to right * SimMouse.Click(MouseButtons.Left, 1780, 0); * Thread.Sleep(1000); * SimMouse.Act(SimMouse.Action.LeftButtonDown, 1780, 0); * Thread.Sleep(1000); * SimMouse.Act(SimMouse.Action.LeftButtonUp, 1780, 200); * Thread.Sleep(1000); * SimMouse.Act(SimMouse.Action.LeftButtonDown, 1780, 200); * Thread.Sleep(1000); * SimMouse.Act(SimMouse.Action.LeftButtonUp, 2780, 200); * Thread.Sleep(1000); * SimMouse.Click(MouseButtons.Left, 3057, 163); * Thread.Sleep(1000); * * //right to left * SimMouse.Act(SimMouse.Action.LeftButtonDown, 3057, 163); * Thread.Sleep(100); * SimMouse.Act(SimMouse.Action.LeftButtonUp, 3057, 363); * Thread.Sleep(100); * SimMouse.Act(SimMouse.Action.LeftButtonDown, 3057, 363); * Thread.Sleep(100); * SimMouse.Act(SimMouse.Action.LeftButtonUp, 1780, 363); */ }); notifyIcon1.Visible = true; timer1.Stop(); this.Hide(); }