🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

probloms with keys...

Started by
1 comment, last by mc30900 18 years, 3 months ago
hello all i am trying to make a program which needs to get some informashion by pressing some keys on the keyboard. some of them i found like VK_UP but i cant find the '+' and '-' but the ones which are near the ')' and they are above 'p' can anyone help me with this? thanks in advance
Advertisement
If you look in your standard include directory you should have a file named "winuser.h", that will list all of the defined virtual key codes. For keys like the standard alphanumeric ones ('A', 'B', '0', '1' etc) you would use something like:
static_cast<int>('KEY NAME GOES IN HERE')
So to use the '+' and '-' keys (on my english keyboard) I would use:
// '+' keystatic_cast<int>('+')// '-' keystatic_cast<int>('-')
As the codes are just their ASCII equivalent, you could go to a site such as www.lookuptables.com and just find the actual numeric code for that key and use that, e.g:
// '+' key = 43 decimal// '-' key = 45 decimal

Hope that helps you [smile].
--
Cheers,
Darren Clark
i'm trying to understand what to i have to write in
keys[]
for those ?

This topic is closed to new replies.

Advertisement