Jump to content
  • Advertisement
Sign in to follow this  
Telamon

Virtual Keycode Hell - or where is VK_EQUALS

This topic is 4883 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've written a convoluted hack of a program that reads text from controls in other programs and dumps it into a console window using WriteConsoleInput. This function basically plays back a series of keystrokes, so the console window thinks text is being typed into it. The API functions to do this require both the ASCII and Virtual Keycodes for any particular key press. The problem is I only have the ASCII codes for the presses I want to send. How can I get the virtual key code from the ascii code? I wrote a little hack that works for the letters A-Z and a-z, but punctuation and other marks don't map over well. While I'm interested in a general purpose solution to this problem (like maybe a lookup table that goes ASCII->VK, the only problem I'm really having at the moment is findind the VK code for the equals button. VK_EQUALS is not defined. Maybe I'm missing something, but I can't find anything that sounds like the equals key in the MSDN docs. PS - I tried VK_ADD, since on my keyboard at least you can get the '+' symbol with Shift + equals key.

Share this post


Link to post
Share on other sites
Advertisement
The official list of key codes is here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/WindowsUserInterface/UserInput/VirtualKeyCodes.asp

The "EQUALS" sign on my keyboard is "SHIFT + ADDITION SIGN", so you would just test: if( Press(VK_OEM_PLUS) && Pressed(VK_SHIFT) ) //Then the Equals sign was typed

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!