Are they virtual codes?

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();
    // code isEqualTo KeyEvent.VK_DELETE : NOTE

}

Link: KeyEvent Class

+5
source share
4 answers

Virtual key codes are extremely virtual, I must say.

- , JavaKeyToWin32Key, Win32KeyToJava .. , .

, . ( "" Apple, 0 - "A", 1 - "S", 2 - "D" .. - " ?).

" ?"

. , , , 15 "", , ( , ).

Java - , . . , "VK_" Microsoft, Java Sun Solaris, .

+3

- MS , . , . : , Java, ASCII. ASCII . OTOH, C, ​​ getchar, , Java, ASCII. (, ASCII/-) , .

ASCII , (, ) .. .

+2

MSDN : " , . - - , . key code. key code - - , . , Windows CE , . , , ".

Here, the set of Virtual Key Codes are the values ​​that you retrieve from the vkCode KBDLLHOOKSTRUCT member .

+1
source

yes, in both cases these are virtual codes.

0
source

All Articles