Get keyboard key name?

Reply

Join Date: Nov 2009
Posts: 1
Reputation: MajesticMoose is an unknown quantity at this point 
Solved Threads: 0
MajesticMoose MajesticMoose is offline Offline
Newbie Poster

Get keyboard key name?

 
0
  #1
24 Days Ago
I need a function that returns the name of a key directly from the keyboard, eg, the input of '32' would return 'Space'.

I know there is a function that does this, but I can't figure out which one.
Last edited by MajesticMoose; 24 Days Ago at 7:20 pm.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,421
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 115
Sponsor
William Hemsworth William Hemsworth is offline Offline
Nearly a Posting Virtuoso
 
0
  #2
24 Days Ago
Nope, not as far as I know, you will just have to create a function to return the right values, this could be a start:
  1. string getValueName(char vk) {
  2. string name;
  3.  
  4. if ( vk >= '0' && vk <= '9' ) {
  5. name.push_back( vk );
  6. return name;
  7. }
  8.  
  9. switch ( vk ) {
  10. case VK_SPACE: return "Space";
  11. case VK_SHIFT: return "Shift";
  12. // ... more cases
  13. }
  14.  
  15. return "";
  16. }
Last edited by William Hemsworth; 24 Days Ago at 7:56 pm.
I need pageviews! most fun profile ever :)
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 355
Reputation: gerard4143 is on a distinguished road 
Solved Threads: 45
gerard4143's Avatar
gerard4143 gerard4143 is offline Offline
Posting Whiz
 
0
  #3
24 Days Ago
Originally Posted by MajesticMoose View Post
I need a function that returns the name of a key directly from the keyboard, eg, the input of '32' would return 'Space'.

I know there is a function that does this, but I can't figure out which one.
I know this is knit picking but....You can't get the name of the key "directly" from the keyboard, its generally via the operating system's kernel....I know knit picking
Reply With Quote Quick reply to this message  
Reply

Tags
keyboard

Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC