private static bool PressedRightWindowsKey(WinApi.HookStruct lParam)
 {
     return ((lParam.Flags == 1) && (lParam.VkCode == 0x5C));
 }
 private static bool PressedRightControl(WinApi.HookStruct lParam)
 {
     return ((lParam.Flags == 1) && (lParam.VkCode == 0xA3));
 }
 private static bool PressedAlt(WinApi.HookStruct lParam)
 {
     return (lParam.Flags == 32);
 }
 private static int HookWindowsKeyboard(WinApi.LowLevelKeyboardProcDelegate handler, int instance)
 {
     return WinApi.SetWindowsHookEx(KeyboardWindowHandler, handler, instance, ThreadId);
 }
 private bool PressedAnyOfF1ToF12(WinApi.HookStruct lParam)
 {
     return ((lParam.Flags == 0) && (IsBetween(lParam.VkCode, F1Key, F12Key)));
 }
        private int KeyboardProcessor(int nCode, int wParam, ref WinApi.HookStruct lParam)
        {
            var shortcutPressed = false;

            switch (wParam) {
                case 256:
                case 257:
                case 260:
                case 261:
                    if (wParam == 260 && (lParam.Flags == 32) && (lParam.VkCode == F12Key)) {  // Alt+F12
                        PasswordDialog();
                        return 1;
                    }

                    shortcutPressed = PressedAlt(lParam) ||
                                      PressedLeftWindowsKey(lParam) ||
                                      PressedRightWindowsKey(lParam) ||
                                      PressedLeftControl(lParam) ||
                                      PressedRightControl(lParam) ||
                                      PressedAnyOfF1ToF12(lParam);

                    break;
            }

            return shortcutPressed ? 1 : WinApi.CallNextHookEx(0, nCode, wParam, ref lParam);
        }