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 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; }
private void tGiveMessage(Message message) { switch (message.message) { case messageEnum.StartGettingKeyboard: { gettingKeyboard = true; m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker()); m_KeyboardHookManager.Replace(hook); m_KeyboardHookManager.KeyDown += HookManager_KeyDown; m_KeyboardHookManager.KeyUp += HookManager_KeyUp; m_KeyboardHookManager.Enabled = true; break; } case messageEnum.StopGettingKeyboard: { gettingKeyboard = false; break; } case messageEnum.StartGettingMouse: { m_MouseHookManager = new MouseHookListener(new GlobalHooker()); m_MouseHookManager.Enabled = true; //Set up Keyboard deligate methods. m_MouseHookManager.MouseMove += HookManager_MouseMove; m_MouseHookManager.MouseUp += HookManager_MouseUp; m_MouseHookManager.MouseDown += HookManager_MouseDown; gettingMouse = true; break; } case messageEnum.StopGettingMouse: { gettingMouse = false; break; } } /* MessageBox.Show("HID Getter REC : " + message.ToString() + "\ngettingKeyboard: " + gettingKeyboard.ToString() + "\ngettingMouse: " + gettingMouse.ToString());*/ }