Archived

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 5530 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.

Ben


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