Exemple #1
0
        private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
            {
                int vkCode = Marshal.ReadInt32(lParam);

                if (vkCode == 175)
                {
                    Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new ThreadStart(delegate
                    {
                        ClientWindow.OnDialInput(EDialInput.Up);
                    }));

                    return((IntPtr)1);
                }
                else if (vkCode == 174)
                {
                    Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new ThreadStart(delegate
                    {
                        ClientWindow.OnDialInput(EDialInput.Down);
                    }));

                    return((IntPtr)1);
                }
                else if (vkCode == 173)
                {
                    Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new ThreadStart(delegate
                    {
                        ClientWindow.OnDialInput(EDialInput.Click);
                    }));

                    return((IntPtr)1);
                }
            }

            return(CallNextHookEx(hookID, nCode, wParam, lParam));
        }