Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


How to filter an input key to keep only valid chars??

This topic is 5754 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

Hi, I implemented a "OnKeyDown(DWORD key)"-routine for my dialog application under windows. I want to intercept all valid keys (which correspond to a valid character) and then add them to a string. Later I want to print that string. The problem is that I don''t know exactly which key is printable... Example: 13 is not printable (return-key) 32 is printable (space-key) 27 is not printable (esk-key) 65 is printable (''a''-key) ... Is there a routine which can check this for me? Thanks

Share this post

Link to post
Share on other sites
You print out the ascii table and look at it. Generally speaking character 32-127 are printable. However, in a text console window you get the special characters as well.

Speaking of which, are there any fonts (preferably TTF) for Windows which include all the original ascii characters?

However, I just use a lookup table. But then I''m going from DInput values to ASCII so it serves more than one purpose. Any input value that isn''t a character is given the value 255 which is ignored.


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Tiberian Merchandise!!!! | GameShot ]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!