Sign in to follow this  
mc30900

probloms with keys...

Recommended Posts

mc30900    100
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

Share this post


Link to post
Share on other sites
eSCHEn    394
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:
// '+' key
static_cast<int>('+')
// '-' key
static_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].

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this