Skip to content

Commit 8e9e046

Browse files
aymanbagabasgopherbot
authored andcommitted
windows: add virtual key codes and console input consts
This adds console input related key codes and consts Change-Id: I8ebd76995a2c9ddd150cf04890a9e5053841fcab GitHub-Last-Rev: 8e534f4 GitHub-Pull-Request: #226 Reviewed-on: https://go-review.googlesource.com/c/sys/+/621495 Reviewed-by: Junyang Shao <[email protected]> Auto-Submit: Michael Pratt <[email protected]> Reviewed-by: Michael Pratt <[email protected]> Reviewed-by: Alex Brainman <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 7138967 commit 8e9e046

File tree

1 file changed

+210
-0
lines changed

1 file changed

+210
-0
lines changed

windows/types_windows.go

+210
Original file line numberDiff line numberDiff line change
@@ -3630,3 +3630,213 @@ const (
36303630
KLF_NOTELLSHELL = 0x00000080
36313631
KLF_SETFORPROCESS = 0x00000100
36323632
)
3633+
3634+
// Virtual Key codes
3635+
// https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
3636+
const (
3637+
VK_LBUTTON = 0x01
3638+
VK_RBUTTON = 0x02
3639+
VK_CANCEL = 0x03
3640+
VK_MBUTTON = 0x04
3641+
VK_XBUTTON1 = 0x05
3642+
VK_XBUTTON2 = 0x06
3643+
VK_BACK = 0x08
3644+
VK_TAB = 0x09
3645+
VK_CLEAR = 0x0C
3646+
VK_RETURN = 0x0D
3647+
VK_SHIFT = 0x10
3648+
VK_CONTROL = 0x11
3649+
VK_MENU = 0x12
3650+
VK_PAUSE = 0x13
3651+
VK_CAPITAL = 0x14
3652+
VK_KANA = 0x15
3653+
VK_HANGEUL = 0x15
3654+
VK_HANGUL = 0x15
3655+
VK_IME_ON = 0x16
3656+
VK_JUNJA = 0x17
3657+
VK_FINAL = 0x18
3658+
VK_HANJA = 0x19
3659+
VK_KANJI = 0x19
3660+
VK_IME_OFF = 0x1A
3661+
VK_ESCAPE = 0x1B
3662+
VK_CONVERT = 0x1C
3663+
VK_NONCONVERT = 0x1D
3664+
VK_ACCEPT = 0x1E
3665+
VK_MODECHANGE = 0x1F
3666+
VK_SPACE = 0x20
3667+
VK_PRIOR = 0x21
3668+
VK_NEXT = 0x22
3669+
VK_END = 0x23
3670+
VK_HOME = 0x24
3671+
VK_LEFT = 0x25
3672+
VK_UP = 0x26
3673+
VK_RIGHT = 0x27
3674+
VK_DOWN = 0x28
3675+
VK_SELECT = 0x29
3676+
VK_PRINT = 0x2A
3677+
VK_EXECUTE = 0x2B
3678+
VK_SNAPSHOT = 0x2C
3679+
VK_INSERT = 0x2D
3680+
VK_DELETE = 0x2E
3681+
VK_HELP = 0x2F
3682+
VK_LWIN = 0x5B
3683+
VK_RWIN = 0x5C
3684+
VK_APPS = 0x5D
3685+
VK_SLEEP = 0x5F
3686+
VK_NUMPAD0 = 0x60
3687+
VK_NUMPAD1 = 0x61
3688+
VK_NUMPAD2 = 0x62
3689+
VK_NUMPAD3 = 0x63
3690+
VK_NUMPAD4 = 0x64
3691+
VK_NUMPAD5 = 0x65
3692+
VK_NUMPAD6 = 0x66
3693+
VK_NUMPAD7 = 0x67
3694+
VK_NUMPAD8 = 0x68
3695+
VK_NUMPAD9 = 0x69
3696+
VK_MULTIPLY = 0x6A
3697+
VK_ADD = 0x6B
3698+
VK_SEPARATOR = 0x6C
3699+
VK_SUBTRACT = 0x6D
3700+
VK_DECIMAL = 0x6E
3701+
VK_DIVIDE = 0x6F
3702+
VK_F1 = 0x70
3703+
VK_F2 = 0x71
3704+
VK_F3 = 0x72
3705+
VK_F4 = 0x73
3706+
VK_F5 = 0x74
3707+
VK_F6 = 0x75
3708+
VK_F7 = 0x76
3709+
VK_F8 = 0x77
3710+
VK_F9 = 0x78
3711+
VK_F10 = 0x79
3712+
VK_F11 = 0x7A
3713+
VK_F12 = 0x7B
3714+
VK_F13 = 0x7C
3715+
VK_F14 = 0x7D
3716+
VK_F15 = 0x7E
3717+
VK_F16 = 0x7F
3718+
VK_F17 = 0x80
3719+
VK_F18 = 0x81
3720+
VK_F19 = 0x82
3721+
VK_F20 = 0x83
3722+
VK_F21 = 0x84
3723+
VK_F22 = 0x85
3724+
VK_F23 = 0x86
3725+
VK_F24 = 0x87
3726+
VK_NUMLOCK = 0x90
3727+
VK_SCROLL = 0x91
3728+
VK_OEM_NEC_EQUAL = 0x92
3729+
VK_OEM_FJ_JISHO = 0x92
3730+
VK_OEM_FJ_MASSHOU = 0x93
3731+
VK_OEM_FJ_TOUROKU = 0x94
3732+
VK_OEM_FJ_LOYA = 0x95
3733+
VK_OEM_FJ_ROYA = 0x96
3734+
VK_LSHIFT = 0xA0
3735+
VK_RSHIFT = 0xA1
3736+
VK_LCONTROL = 0xA2
3737+
VK_RCONTROL = 0xA3
3738+
VK_LMENU = 0xA4
3739+
VK_RMENU = 0xA5
3740+
VK_BROWSER_BACK = 0xA6
3741+
VK_BROWSER_FORWARD = 0xA7
3742+
VK_BROWSER_REFRESH = 0xA8
3743+
VK_BROWSER_STOP = 0xA9
3744+
VK_BROWSER_SEARCH = 0xAA
3745+
VK_BROWSER_FAVORITES = 0xAB
3746+
VK_BROWSER_HOME = 0xAC
3747+
VK_VOLUME_MUTE = 0xAD
3748+
VK_VOLUME_DOWN = 0xAE
3749+
VK_VOLUME_UP = 0xAF
3750+
VK_MEDIA_NEXT_TRACK = 0xB0
3751+
VK_MEDIA_PREV_TRACK = 0xB1
3752+
VK_MEDIA_STOP = 0xB2
3753+
VK_MEDIA_PLAY_PAUSE = 0xB3
3754+
VK_LAUNCH_MAIL = 0xB4
3755+
VK_LAUNCH_MEDIA_SELECT = 0xB5
3756+
VK_LAUNCH_APP1 = 0xB6
3757+
VK_LAUNCH_APP2 = 0xB7
3758+
VK_OEM_1 = 0xBA
3759+
VK_OEM_PLUS = 0xBB
3760+
VK_OEM_COMMA = 0xBC
3761+
VK_OEM_MINUS = 0xBD
3762+
VK_OEM_PERIOD = 0xBE
3763+
VK_OEM_2 = 0xBF
3764+
VK_OEM_3 = 0xC0
3765+
VK_OEM_4 = 0xDB
3766+
VK_OEM_5 = 0xDC
3767+
VK_OEM_6 = 0xDD
3768+
VK_OEM_7 = 0xDE
3769+
VK_OEM_8 = 0xDF
3770+
VK_OEM_AX = 0xE1
3771+
VK_OEM_102 = 0xE2
3772+
VK_ICO_HELP = 0xE3
3773+
VK_ICO_00 = 0xE4
3774+
VK_PROCESSKEY = 0xE5
3775+
VK_ICO_CLEAR = 0xE6
3776+
VK_OEM_RESET = 0xE9
3777+
VK_OEM_JUMP = 0xEA
3778+
VK_OEM_PA1 = 0xEB
3779+
VK_OEM_PA2 = 0xEC
3780+
VK_OEM_PA3 = 0xED
3781+
VK_OEM_WSCTRL = 0xEE
3782+
VK_OEM_CUSEL = 0xEF
3783+
VK_OEM_ATTN = 0xF0
3784+
VK_OEM_FINISH = 0xF1
3785+
VK_OEM_COPY = 0xF2
3786+
VK_OEM_AUTO = 0xF3
3787+
VK_OEM_ENLW = 0xF4
3788+
VK_OEM_BACKTAB = 0xF5
3789+
VK_ATTN = 0xF6
3790+
VK_CRSEL = 0xF7
3791+
VK_EXSEL = 0xF8
3792+
VK_EREOF = 0xF9
3793+
VK_PLAY = 0xFA
3794+
VK_ZOOM = 0xFB
3795+
VK_NONAME = 0xFC
3796+
VK_PA1 = 0xFD
3797+
VK_OEM_CLEAR = 0xFE
3798+
)
3799+
3800+
// Mouse button constants.
3801+
// https://docs.microsoft.com/en-us/windows/console/mouse-event-record-str
3802+
const (
3803+
FROM_LEFT_1ST_BUTTON_PRESSED = 0x0001
3804+
RIGHTMOST_BUTTON_PRESSED = 0x0002
3805+
FROM_LEFT_2ND_BUTTON_PRESSED = 0x0004
3806+
FROM_LEFT_3RD_BUTTON_PRESSED = 0x0008
3807+
FROM_LEFT_4TH_BUTTON_PRESSED = 0x0010
3808+
)
3809+
3810+
// Control key state constaints.
3811+
// https://docs.microsoft.com/en-us/windows/console/key-event-record-str
3812+
// https://docs.microsoft.com/en-us/windows/console/mouse-event-record-str
3813+
const (
3814+
CAPSLOCK_ON = 0x0080
3815+
ENHANCED_KEY = 0x0100
3816+
LEFT_ALT_PRESSED = 0x0002
3817+
LEFT_CTRL_PRESSED = 0x0008
3818+
NUMLOCK_ON = 0x0020
3819+
RIGHT_ALT_PRESSED = 0x0001
3820+
RIGHT_CTRL_PRESSED = 0x0004
3821+
SCROLLLOCK_ON = 0x0040
3822+
SHIFT_PRESSED = 0x0010
3823+
)
3824+
3825+
// Mouse event record event flags.
3826+
// https://docs.microsoft.com/en-us/windows/console/mouse-event-record-str
3827+
const (
3828+
MOUSE_MOVED = 0x0001
3829+
DOUBLE_CLICK = 0x0002
3830+
MOUSE_WHEELED = 0x0004
3831+
MOUSE_HWHEELED = 0x0008
3832+
)
3833+
3834+
// Input Record Event Types
3835+
// https://learn.microsoft.com/en-us/windows/console/input-record-str
3836+
const (
3837+
FOCUS_EVENT = 0x0010
3838+
KEY_EVENT = 0x0001
3839+
MENU_EVENT = 0x0008
3840+
MOUSE_EVENT = 0x0002
3841+
WINDOW_BUFFER_SIZE_EVENT = 0x0004
3842+
)

0 commit comments

Comments
 (0)