Exemplo n.º 1
0
        static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
            {
                var vkCode = (Keys)Marshal.ReadInt32(lParam);
                //Console.WriteLine(vkCode);

                if (Keys.Scroll == vkCode)
                {
                    ConfigManager.Muted = Control.IsKeyLocked(Keys.Scroll);
                }

                switch (vkCode)
                {
                //Ignore keys that are used in class GlobalHotKey
                case Keys.Scroll:
                case Keys.CapsLock:
                case Keys.F13:
                case Keys.LWin:
                case Keys.RWin:
                case Keys.Insert:
                    break;

                default:
                    if (ConfigManager.MuteOnKeyPress)
                    {
                        MuteTimer.Reset();
                    }
                    break;
                }
            }
            return(CallNextHookEx(_hookID, nCode, wParam, lParam));
        }
Exemplo n.º 2
0
 public MuteTimer()
 {
     timer    = new Timer(Tick);
     instance = this;
 }