Exemple #1
0
        private static KeyStates GetKeyState(Keys key)
        {
            KeyStates state = KeyStates.None;

            short retVal = NativeImport.GetKeyState((int)key);

            if ((retVal & 0x8000) == 0x8000)
            {
                state |= KeyStates.Down;
            }

            if ((retVal & 1) == 1)
            {
                state |= KeyStates.Toggled;
            }

            return(state);
        }