Exemple #1
0
        internal IntPtr WndCall(ref Message msg)
        {
            const int wmHotkey = 0x0312;

            switch (msg.Msg)
            {
            case wmHotkey:
                if (msg.WParam.ToInt32() == _hotKeyUniqueId)
                {
                    int vkey = ((int)msg.LParam >> 16) & 0xFFFF;
                    if (vkey == _finalKey)
                    {
                        OnTriggerFunction?.Invoke(this, EventArgs.Empty);
                    }
                }
                break;
            }
            return(IntPtr.Zero);
        }
        private IntPtr HwndHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            const int wmHotkey = 0x0312;

            switch (msg)
            {
            case wmHotkey:
                if (wParam.ToInt32() == _hotId)
                {
                    int vkey = (((int)lParam >> 16) & 0xFFFF);
                    if (vkey == _finalKey)
                    {
                        OnTriggerFunction?.Invoke(this, EventArgs.Empty);
                    }
                    handled = true;
                }
                break;
            }
            return(IntPtr.Zero);
        }