Beispiel #1
0
 protected virtual void OnHookEvent(HookEventArgs hookArgs, KeyBoardInfo keyBoardInfo)
 {
     if (HookEvent != null)
     {
         HookEvent(hookArgs, keyBoardInfo);
     }
 }
Beispiel #2
0
        private void HookEvent(HookEventArgs e, KeyBoardInfo keyBoardInfo)
        {
            /*
             * This method is called, when any hardware button on FC-200 is pressed.
             * When the home button is pressed, foreground windows toggles between
             * ReachConnectCE and TopSURV.
             *
             * FC-200 HARDWARE KEYS
             *                          wParam      wParam
             *              vkCode:     key down:   key up:
             *
             * ENT button      13          256         257
             * Alt button:     18          260         261
             * ESC button:     27          256         257
             * Home button:    36          256         257
             * Left button:    37          256         257
             * Up button       38          256         257
             * Right button    39          256         257
             * Down button     40          256         257
             * Windows button: 92          256         257
             */

            if (keyBoardInfo.vkCode == 36 && e.wParam.ToInt32() == 256) // Home button pressed
            {
                ToggleWindow();
            }

            if (keyBoardInfo.vkCode == 40 && e.wParam.ToInt32() == 256) // Down button pressed
            {
                // Show/hide software input panel (SIP)
                if (!inputPanel1.Enabled)
                {
                    inputPanel1.Enabled = true;
                }
                else
                {
                    inputPanel1.Enabled = false;
                }
            }
        }
Beispiel #3
0
        private int HookProcedure(int code, IntPtr wParam, IntPtr lParam)
        {
            KBDLLHOOKSTRUCT hookStruct = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(KBDLLHOOKSTRUCT));

            if (code < 0)
            {
                return(CallNextHookEx(hookDeleg, code, wParam, lParam));
            }
            // Let clients determine what to do
            HookEventArgs e = new HookEventArgs();

            e.Code   = code;
            e.wParam = wParam;
            e.lParam = lParam;
            KeyBoardInfo keyInfo = new KeyBoardInfo();

            keyInfo.vkCode   = hookStruct.vkCode;
            keyInfo.scanCode = hookStruct.scanCode;
            OnHookEvent(e, keyInfo);
            // Yield to the next hook in the chain
            return(CallNextHookEx(hookDeleg, code, wParam, lParam));
        }