Recognizing which Shift/Toggle key is Pressed

It is an easy job to recognize which key the user has pressed by checking its virtual key code. But some efforts are needed to be taken to distinguish between left and right keys. The eighth bit of virtual key code contains 1 if Alt and Ctrl keys at the right side of the keyboard, the cursor movement keys including Insert and Delete that are not the part of the Numeric Keypad, Slash(/) and Enter keys on the Num Pad and the Num Lock key are hit. If this particular bit is checked along with the virtual key code we can easily print out which key has been hit.

No comments: