Question regarding characters
Hi!
Im reading wm_keydown and wm_char. But I got this problem.. I want to read other keys than the usual a-z 1-9. But I found that not all keys correspond to the ASCII chart for instance, if I press button "a" (ascii 97) - I get a big "A" (ascii65) instead. if I press "." (ascii 46) wparam returns 190
I''ve read about wm_keydown and wparam at msdn, and it says "wParam - Specifies the virtual-key code of the nonsystem key." It didn''t say how to fix the problem really...
I have seen many applications reading these keys, including å ä ö among others.. is there an easy way around this?
On the assumption that key holds the keycode returned from the windows message, use this bit of code...
// need an array to hold all of the keystates....unsigned char pKeys[256];// get the keyboard state for the ToAscii functionGetKeyboardState(pKeys);// variable to hold the ascii code...unsigned short pRet = 0;// get the ascii key code...ToAscii(key,0,pKeys,&pRet,0);// convert to char...char asciiCode = (char)pRet;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement