본문 바로가기
개발언어/.NET

Windows Keyboard 이벤트

by 공장장코난 2021. 1. 22.

Windows 키보드 이벤트 코드 나열

KeyCode Value KeyCode Value
VK_BACK 0x08(8) VK_NUMPAD8 0x68(104)
VK_TAB 0x09(9) VK_NUMPAD9 0x69(105)
VK_RETURN 0x0D(13) VK_MULTIPLY 0x6A(106)
VK_SHIFT 0x10(16) VK_ADD 0x6B(107)
VK_CONTROL 0x11(17) VK_SEPARATOR 0x6C(108)
VK_MENU 0x12(18) VK_SUBTRACT 0x6D(109)
VK_PAUSE 0x13(19) VK_DECIMAL 0x6E(110)
VK_CAPITAL 0x14(20) VK_DIVIDE 0x6F(111)
VK_ESCAPE 0x1B(27) VK_F1 0x70(112)
VK_SPACE 0x20(32) VK_F2 0x71(113)
VK_END 0x23(35) VK_F3 0x72(114)
VK_HOME 0x24(36) VK_F4 0x73(115)
VK_LEFT 0x25(37) VK_F5 0x74(116)
VK_UP 0x26(38) VK_F6 0x75(117)
VK_RIGHT 0x27(39) VK_F7 0x76(118)
VK_DOWN 0x28(40) VK_F8 0x77(119)
VK_PRINT 0x2A(42) VK_F9 0x78(120)
VK_SNAPSHOT 0x2C(44) VK_F10 0x79(121)
VK_INSERT 0x2D(45) VK_F11 0x7A(122)
VK_DELETE 0x2E(46) VK_F12 0x7B(123)
VK_LWIN 0x5B(91) VK_NUMLOCK 0x90(144)
VK_RWIN 0x5C(92) VK_SCROLL 0x91(145)
VK_NUMPAD0 0x60(96) VK_LSHIFT 0xA0(160)
VK_NUMPAD1 0x61(97) VK_RSHIFT 0xA1(161)
VK_NUMPAD2 0x62(98) VK_LCONTROL 0xA2(162)
VK_NUMPAD3 0x63(99) VK_RCONTROL 0xA3(163)
VK_NUMPAD4 0x64(100) VK_LMENU 0xA4(164)
VK_NUMPAD5 0x65(101) VK_RMENU 0xA5(165)
VK_NUMPAD6 0x66(102)    
VK_NUMPAD7 0x67(103)    

Ex)TextBox KeyDown 이벤트 처리
private void OnInput_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
    if (e.Key == Key.Enter)
    {
      ...
    }
}

Ex)Keyboard Hook 이벤트 처리
public override int Hook_KeyDown(int nKeyCode)
{
   if (nKeyCode == 13)
   {
      ...
   }
}