WH_Keyboard

  • Thread starter Thread starter Yehia A.Salam
  • Start date Start date
Y

Yehia A.Salam

Hello,

Why does the WH_Keyboard hook intercept all keys as capital letters? for
example when I type "a" I get a 65 keycode (Virtual Key Code for A) in the
wParam of the filter function though I should have got 97 (Virtual Key Code
for a)

Thanks
Yehia A.Salam
 
Why does the WH_Keyboard hook intercept all keys as capital letters? for
example when I type "a" I get a 65 keycode (Virtual Key Code for A) in the
wParam of the filter function though I should have got 97 (Virtual Key Code
for a)

Virtual key codes represent keys, not letters. There is only one code
(65, 0x41) representing pressing the A key on the keyboard, whether it
will turn into a capital letter or not. The code 97 (0x61) is
VK_NUMPAD1, it has nothing to do with the A key. I think you're
confusing virtual key codes with ASCII character codes.

To differentiate between small and capital letters you'll have to
check the state of the Shift and Caps Lock keys, or listen to WM_CHAR
messages instead of keyboard messages.


Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top