OnKeyUp()
-
hi, When i press {,[ keys in keyboard i get nChar in OnKeyUp() as 219 And when i press },] keys i get 221. I dont know actually what menas nChar, i see it in MSDN..i get confused...for 1,2,3 keys i get ASCII value of that particular keys coreectly. But ASCII for { is 123 then why it shows like 219. Pls clear my confusion.....
Anu
-
hi, When i press {,[ keys in keyboard i get nChar in OnKeyUp() as 219 And when i press },] keys i get 221. I dont know actually what menas nChar, i see it in MSDN..i get confused...for 1,2,3 keys i get ASCII value of that particular keys coreectly. But ASCII for { is 123 then why it shows like 219. Pls clear my confusion.....
Anu
Well, as stated by the documentation [^], the
nChar
argument passed to theOnKeyUp()
handler, is the virtual key code of the given key, hence it isn't itsASCII
code. The fact that the two quantities are the same for numeric (and for letters'A'
to'Z'
) keys is a mere (well, not casual, and useful ;) ) coincidence. Anyway the ultimate reference for virtual key codes is (again documentation states it) theWinuser.h
header file :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
[my articles] -
hi, When i press {,[ keys in keyboard i get nChar in OnKeyUp() as 219 And when i press },] keys i get 221. I dont know actually what menas nChar, i see it in MSDN..i get confused...for 1,2,3 keys i get ASCII value of that particular keys coreectly. But ASCII for { is 123 then why it shows like 219. Pls clear my confusion.....
Anu
try WM_CHAR instead of WM_KEYUP.
nave [OpenedFileFinder]
-
try WM_CHAR instead of WM_KEYUP.
nave [OpenedFileFinder]
It's right, but it is sent when the key is down. He may be demanding the "key up" itself.
- NS - [ODBaseBtn]
-
try WM_CHAR instead of WM_KEYUP.
nave [OpenedFileFinder]
-
I used WM_CHAR but when i press combiantions like Shift-F1,ctrl-F10 the control does not go to OnChar(). What can i do for that? I need to find ASCII fro combination of two keys like Ctrl-F1,ctrl-F2..like that.
Anu
Anu_Bala wrote:
when i press combiantions like Shift-F1,ctrl-F10 the control does not go to OnChar().
WM_CHAR message will not be raised for such type keys like functions keys, page up, page down, home, end etc. If you want to handle such keys also then you have to use the WM_KEYUP/WM_KEYDOWN itself. If you are handling the message in the WM_KEYUP/WM_KEYDOWN, check the nchar aganist the values like VK_OEM_4 for '[' and '{' , VK_OEM_6 for ']' and '}' . Check the winuser.h for all the virtual key codes.
nave [OpenedFileFinder]
-
Anu_Bala wrote:
when i press combiantions like Shift-F1,ctrl-F10 the control does not go to OnChar().
WM_CHAR message will not be raised for such type keys like functions keys, page up, page down, home, end etc. If you want to handle such keys also then you have to use the WM_KEYUP/WM_KEYDOWN itself. If you are handling the message in the WM_KEYUP/WM_KEYDOWN, check the nchar aganist the values like VK_OEM_4 for '[' and '{' , VK_OEM_6 for ']' and '}' . Check the winuser.h for all the virtual key codes.
nave [OpenedFileFinder]
Why not just use keyboard accelerators[^]?
Florin Crisan