Virtual key codes for some keys, such as shift, [,], Del, etc. are displayed as a different value in java compared to C ++ / C. For instance:
Key Java C / C++
Shift 16 160
[ 91 219
] 93 221
\ 92 220
Del 127 46
Window 524 91
What is the reason for this? Are these codes virtual codes or are they different from others? For keys, including alphabets, numbers, function keys (F1-F12), backspace, `, etc. The same.
I could misunderstand the concept, in this case clarify.
Tested in C / C ++
KBDLLHOOKSTRUCT * kbhook = (KBDLLHOOKSTRUCT *) lParam;
printf("%u\n",kbhook->vkCode);
Tested in Java
private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {
int code = evt.getKeyCode();
}
Link: KeyEvent Class
source
share