Esempio n. 1
0
 public void Unsubscribe()
 {
     m_GlobalHook.MouseDownExt -= GlobalHookMouseDownExt;
     //m_GlobalHook.KeyPress -= GlobalHookKeyPress;
     //It is recommened to dispose it
     m_GlobalHook.Dispose();
 }
Esempio n. 2
0
        private void checkBoxCapturadorLigado_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox objComboBox = (CheckBox)sender;

            objComboBox.BackColor = Color.Transparent;
            objComboBox.ForeColor = Color.DimGray;
            if (objComboBox.Checked == true)
            {
                textBoxTituloCaptura.Focus();
                objComboBox.BackColor = Color.LightGreen;
                objComboBox.ForeColor = Color.DimGray;
                m_GlobalHook          = Hook.GlobalEvents();
                CapturadorPixel.objModelTelaInicial = null;
                m_GlobalHook.MouseDownExt          += obterPixelPorClique;
                if (checkBoxMostraPixelMovimentoMouse.Checked == true)
                {
                    m_GlobalHook.MouseMoveExt += exibirPixelMovimentoMouse;
                }
            }
            else
            {
                m_GlobalHook.MouseDownExt -= obterPixelPorClique;
                m_GlobalHook.MouseMoveExt -= exibirPixelMovimentoMouse;
                m_GlobalHook.Dispose();
            }
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (IsActive)
            {
                globalKeyboardHook.KeyDown -= GlobalHook_KeyDown;
                globalKeyboardHook.Dispose();

                LogitechGSDK.LogiLedStopEffects();
                LogitechGSDK.LogiLedRestoreLighting();

                (sender as Button).Text = "Start";
                IsActive = false;
            }
            else
            {
                globalKeyboardHook          = Hook.GlobalEvents();
                globalKeyboardHook.KeyDown += GlobalHook_KeyDown;

                (sender as Button).Text = "Stop";

                LogitechGSDK.LogiLedInit();
                Thread.Sleep(100); //init needs some time... this shouldn't block the UI-thread, but it's the best solution for now...
                LogitechGSDK.LogiLedSaveCurrentLighting();

                ActivateKey();
                IsActive = true;
            }
        }
Esempio n. 4
0
 private void Widget_FormClosing(object sender, FormClosingEventArgs e)
 {
     hook.Dispose();
     timer.Stop();
     previewImage.Dispose();
     screenshot.Dispose();
     isClosing();
 }
Esempio n. 5
0
        public void Unsubscribe()
        {
            m_GlobalHook.KeyDown -= GlobalHookKeyDown;

            //It is recommened to dispose it
            m_GlobalHook.Dispose();
        }
Esempio n. 6
0
 private void DisposeHooks()
 {
     Win32.ChangeClipboardChain(hWndSource.Handle, hWndNextViewer);
     hWndNextViewer = IntPtr.Zero;
     hWndSource.RemoveHook(WinProc);
     globalMouseHook.Dispose();
 }
Esempio n. 7
0
        private void UnsubscribeHooks()
        {
            globalMouseHook.MouseWheelExt -= GlobalHookMouseWheel;
            globalMouseHook.MouseDownExt  -= GlobalHookMouseDown;

            globalMouseHook.Dispose();
        }
Esempio n. 8
0
    protected override void OnClosed(EventArgs e)
    {
        m_GlobalHook.MouseClick -= m_GlobalHook_MouseClick;
        m_GlobalHook.Dispose();

        base.OnClosed(e);
    }
Esempio n. 9
0
        private void Unsubscribe()
        {
            if (m_Events != null)
            {
                //m_Events.KeyDown -= OnKeyDown;
                //m_Events.KeyUp -= OnKeyUp;
                //m_Events.KeyPress -= HookManager_KeyPress;

                //m_Events.MouseUp -= OnMouseUp;
                //m_Events.MouseClick -= OnMouseClick;
                //m_Events.MouseDoubleClick -= OnMouseDoubleClick;

                m_Events.MouseMove -= HookManager_MouseMove;

                //if (checkBoxSupressMouseWheel.Checked)
                //    m_Events.MouseWheelExt -= HookManager_MouseWheelExt;
                //else
                //    m_Events.MouseWheel -= HookManager_MouseWheel;

                //if (checkBoxSuppressMouse.Checked)
                //    m_Events.MouseDownExt -= HookManager_Supress;
                //else
                //    m_Events.MouseDown -= OnMouseDown;

                m_Events.Dispose();
                m_Events = null;
            }

            if (k_hook != null)
            {
                k_hook.KeyDownEvent -= Hook_KeyDown;
                k_hook.Stop();
                k_hook = null;
            }
        }
Esempio n. 10
0
        private void Window_Closed(object sender, EventArgs e)
        {
            _hook.KeyUp -= keyUp_hook;
            _hook.Dispose();


            if (_fullPaths.Count != 0)
            {
                string Dir = $"{AppDomain.CurrentDomain.BaseDirectory}currentPlaylist.txt";
                using (StreamWriter sw = File.CreateText(Dir))
                {
                    if (_lastIndex == -1)
                    {
                        _lastIndex = 0;
                    }
                    sw.WriteLine($"{_player.Position.TotalSeconds}");
                    sw.WriteLine($"{_lastIndex.ToString()}");
                    for (int i = 0; i < SongDirectory.Count(); i++)
                    {
                        sw.WriteLine($"{SongDirectory[i]}");
                    }
                }
            }
            else
            {
                string Dir = $"{AppDomain.CurrentDomain.BaseDirectory}currentPlaylist.txt";
                File.Delete(Dir);
            }
        }
Esempio n. 11
0
 private void GlobalHookMouseDownExt(object sender, MouseEventExtArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         IntPtr handle = WindowFromPoint(e.X, e.Y);
         foreach (var p in processWithWindow)
         {
             if (p.MainWindowHandle == handle)
             {
                 StringBuilder stringBuilder = new StringBuilder();
                 stringBuilder.Append($"名称:{p.MainModule.FileVersionInfo.ProductName}{Environment.NewLine}");
                 stringBuilder.Append($"版本:{p.MainModule.FileVersionInfo.FileVersion}{Environment.NewLine}");
                 stringBuilder.Append($"描述:{p.MainModule.FileVersionInfo.FileDescription}{Environment.NewLine}");
                 this.info.Text = stringBuilder.ToString();
                 break;
             }
         }
     }
     if (e.Button == MouseButtons.Right)
     {
         m_GlobalHook.MouseDownExt -= GlobalHookMouseDownExt;
         m_GlobalHook.MouseDownExt -= M_GlobalHook_MouseMoveExt;
         m_GlobalHook.Dispose();
     }
 }
Esempio n. 12
0
        private void Unsubscribe()
        {
            if (m_Events == null)
            {
                return;
            }

//            /m_Events.KeyDown = (EventHandler)Delegate.RemoveAll(m_Events.KeyDown as Delegate, m_Events.KeyDown);

            m_Events.KeyDown -= RegisterFastClickButton;
            m_Events.KeyDown -= CheckFastKey;
            m_Events.KeyDown -= ClickBindKeyPress;
            m_Events.KeyDown -= SpecialCickBindPress;
            m_Events.KeyDown -= StartClickRecording;
            m_Events.KeyDown -= StopRecording;
            m_Events.KeyDown -= RecordKey;

            m_Events.MouseDownExt -= FastClickReg;
            m_Events.MouseUpExt   -= FastClickUp;
            m_Events.MouseUpExt   -= SupressKeyResign;
            m_Events.MouseClick   -= RecordingMouseActivity;
            m_Events.MouseMoveExt -= SupressMouseWhilePlaying;

            m_Events.Dispose();
            m_Events = null;
        }
Esempio n. 13
0
 public void UnsubscribeAll()
 {
     globalHook.MouseMoveExt -= GlobalHookMouseMove;
     globalHook.KeyPress     -= GlobalDeactivateKeyPress;
     globalHook.KeyDown      -= GlobalDeactivateModifier;
     globalHook.Dispose();
 }
Esempio n. 14
0
        private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            globalHook.KeyDown -= OnGlobalKeyDown;
            globalHook.Dispose();
            globalHook = null;

            watch.Stop();
            Config.Sequencer.Stop();
            playbackUITimer.Stop();

            SaveConfig(true);

            // Disconnect the host or client
            if (server != null)
            {
                server.Stop();
            }
            if (client != null)
            {
                client.Disconnect();
            }

            // Make sure to dispose of these
            Config.Sequencer.Dispose();
            Config.OutputDevice.Dispose();
        }
Esempio n. 15
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     g.MouseMoveExt -= G_MouseMoveExt;
     g.KeyUp        -= G_KeyUp;
     g.KeyDown      -= G_KeyDown;
     g.Dispose();
 }
Esempio n. 16
0
 public void UnsubscribeFromMouseKeyEvents()
 {
     _GlobalHook.MouseDownExt -= MouseDown;
     _GlobalHook.MouseMoveExt -= MouseDown;
     _GlobalHook.KeyPress     -= KeyPress;
     _GlobalHook.Dispose();
 }
        private void Window_Closed(object sender, EventArgs e)
        {
            var filename = "playlist.txt";
            var writer   = new StreamWriter(filename);


            if (_fullPaths.Count > 0)
            {
                if (_lastIndex == -1)
                {
                    _lastIndex = 0;
                }
                writer.WriteLine(RepeatMode);
                writer.WriteLine(ShuffleMode);
                writer.WriteLine(_lastIndex);
                writer.WriteLine((int)_player.Position.TotalSeconds);
                foreach (var item in _fullPaths)
                {
                    writer.WriteLine(item);
                }
            }
            writer.Close();
            _hook.KeyUp -= KeyUp_hook;
            _hook.Dispose();
        }
Esempio n. 18
0
        private void Unsubscribe()
        {
            if (m_Events == null)
            {
                return;
            }
            //m_Events.KeyDown -= OnKeyDown;
            //m_Events.KeyUp -= OnKeyUp;
            //m_Events.KeyPress -= HookManager_KeyPress;

            //m_Events.MouseUp -= OnMouseUp;
            //m_Events.MouseClick -= OnMouseClick;
            //m_Events.MouseDoubleClick -= OnMouseDoubleClick;

            m_Events.MouseMove -= HookManager_MouseMove;

            //m_Events.MouseDragStarted -= OnMouseDragStarted;
            //m_Events.MouseDragFinished -= OnMouseDragFinished;

            //if (checkBoxSupressMouseWheel.Checked)
            //m_Events.MouseWheelExt -= HookManager_MouseWheelExt;
            //else
            //m_Events.MouseWheel -= HookManager_MouseWheel;

            //if (checkBoxSuppressMouse.Checked)
            //m_Events.MouseDownExt -= HookManager_Supress;
            //else
            //m_Events.MouseDown -= OnMouseDown;

            m_Events.Dispose();
            m_Events = null;
        }
Esempio n. 19
0
        public void Unsubscribe()
        {
            m_GlobalHook.MouseDownExt -= GlobalHookMouseDownExt;
            m_GlobalHook.KeyPress     -= GlobalHookKeyPress;

            m_GlobalHook.Dispose();
        }
Esempio n. 20
0
 private void Unsubscribe()
 {
     _mGlobalHook.MouseWheel -= GlobalHook_MouseWheel;
     _mGlobalHook.KeyDown    -= GlobalHook_KeyDown;
     _mGlobalHook.KeyUp      -= GlobalHook_KeyUp;
     _mGlobalHook.Dispose();
 }
Esempio n. 21
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            log.Debug("Window is closing. Dispose global Input hook.");

            //It is recommened to dispose it
            m_GlobalHook.Dispose();
        }
Esempio n. 22
0
        private void Unsubscribe()
        {
            if (m_Events == null)
            {
                return;
            }
            m_Events.KeyDown  -= OnKeyDown;
            m_Events.KeyUp    -= OnKeyUp;
            m_Events.KeyPress -= HookManager_KeyPress;

            m_Events.MouseUp          -= OnMouseUp;
            m_Events.MouseClick       -= OnMouseClick;
            m_Events.MouseDoubleClick -= OnMouseDoubleClick;

            m_Events.MouseMove -= HookManager_MouseMove;

            m_Events.MouseDragStarted  -= OnMouseDragStarted;
            m_Events.MouseDragFinished -= OnMouseDragFinished;

            m_Events.MouseWheel -= HookManager_MouseWheel;

            m_Events.MouseDown -= OnMouseDown;

            m_Events.Dispose();
            m_Events = null;
        }
Esempio n. 23
0
 void hook_stop()
 {
     if (hook != null)
     {
         hook.Dispose();
     }
 }
Esempio n. 24
0
        private void Window_Closing(object sender, CancelEventArgs e)
        {
            try
            {
                m_GlobalHook.KeyUp -= KeyUp_hook;
                m_GlobalHook.Dispose();
                StreamWriter sw = new StreamWriter("lastPlaying");
                if (_playlist.Count == 0)
                {
                    index = -1;
                }
                sw.WriteLine(index.ToString());
                sw.Close();
                StreamWriter sq = new StreamWriter("lastlist");
                for (int i = 0; i < _playlist.Count(); i++)
                {
                    sq.WriteLine(_playlist[i].Path);
                }

                sq.Close();
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 25
0
        /// <summary>
        /// 卸载钩子
        /// </summary>
        /// <param name="UninstallKeyboardHook">键盘钩子 默认卸载</param>
        /// <param name="UninstallMouseHook">鼠标钩子 默认卸载</param>
        public void Unsubscribe(bool UninstallKeyboardHook = true, bool UninstallMouseHook = true)
        {
            // 键盘鼠标都卸载
            if (UninstallMouseHook && UninstallKeyboardHook)
            {
                m_GlobalHook.MouseClick       -= GlobalHookMouseClick;
                m_GlobalHook.MouseDoubleClick -= GlobalHookMouseClick;
                m_GlobalHook.MouseMoveExt     -= GlobalHookMouseMoveExt;
                m_GlobalHook.MouseDownExt     -= GlobalHookMouseDownExt;
                m_GlobalHook.KeyDown          -= GlobalHookKeyDownExt;

                //It is recommened to dispose it
                m_GlobalHook.Dispose();
                return;
            }

            // 只卸载按键
            if (!UninstallMouseHook && UninstallKeyboardHook)
            {
                m_GlobalHook.KeyDown -= GlobalHookKeyDownExt;
                return;
            }
            // 只卸载鼠标
            if (!UninstallKeyboardHook && UninstallMouseHook)
            {
                m_GlobalHook.MouseClick       -= GlobalHookMouseClick;
                m_GlobalHook.MouseDoubleClick -= GlobalHookMouseClick;
                m_GlobalHook.MouseMoveExt     -= GlobalHookMouseMoveExt;
                m_GlobalHook.MouseDownExt     -= GlobalHookMouseDownExt;
                return;
            }
        }
        protected override void Dispose(bool disposing)
        {
            _globalHook.MouseMoveExt -= OnGlobalMouseMove;
            _globalHook.Dispose();

            base.Dispose(disposing);
        }
Esempio n. 27
0
 public void Dispose()
 {
     if (_globalHook != null)
     {
         _globalHook.Dispose();
     }
 }
Esempio n. 28
0
        public void Unsubscribe()
        {
            _keyboardGlobalHook.KeyPress -= KeyboardGlobalHookKeyPress;

            //It is recommened to dispose it
            _keyboardGlobalHook.Dispose();
        }
Esempio n. 29
0
        public void Unsubscribe()
        {
            _globalHook.MouseDownExt -= GlobalHookMouseDownExt;
            _globalHook.KeyDown      += _keyboardMouseEvents_KeyDown;

            _globalHook.Dispose();
        }
Esempio n. 30
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!exit)
            {
                this.Hide();
                e.Cancel = true;
                return;
            }

            PSVRController.DeviceDisconnected();

            try
            {
                if (hookedEvents != null)
                {
                    hookedEvents.KeyDown -= HookedEvents_KeyDown;
                    hookedEvents.Dispose();
                }
            }
            catch { }

            trayIcon.Visible = false;

            if (CurrentOS.IsLinux)
            {
                Environment.Exit(0);
            }
        }
 private void RegisterKeyHooks()
 {
     globalKeyMouseHook = Hook.GlobalEvents();
     globalKeyMouseHook.MouseDownExt += (send, e) => {
         if (!ApplicationIsActivated()) return;
         switch (e.Button)
         {
             case MouseButtons.XButton1:
                 navigateBackBrowser();
                 break;
             case MouseButtons.XButton2:
                 navigateForwardBrowser();
                 break;
         }
     };
     globalKeyMouseHook.KeyUp += new KeyEventHandler(gkh_KeyUp);
     FormClosed += (send, e) =>
     {
         globalKeyMouseHook.Dispose();
     };
 }