Ejemplo n.º 1
0
        private bool KeyboardHook_OnKeyboardEvent(uint key, BaseHook.KeyState keyState)
        {
            KeyboardEvent kEvent = new KeyboardEvent {
                Key    = (Keys)key,
                Action = (keyState == BaseHook.KeyState.Keydown) ? Constants.KEY_DOWN : Constants.KEY_UP
            };

            LogKeyboardEvents(kEvent);
            return(false);
        }
Ejemplo n.º 2
0
        private void LogKeyboardEvents(KeyboardEvent kEvent)
        {
            count++;
            Record item = new Record
            {
                Id       = count,
                Type     = Constants.KEYBOARD,
                EventKey = kEvent,
                Content  = String.Format("{0} was {1}", kEvent.Key.ToString(),
                                         (kEvent.Action == Constants.KEY_DOWN) ? "pressed" : "released")
            };

            AddRecordItem(item);
        }