VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

A KeyCode to Strings Converter

Alexander Chia  (3 Submissions)   VB function enhancement   Visual Basic 3.0   Beginner   Wed 3rd February 2021

It is a function that converts keycodes like those used in _KeyDown events, to strings like "Ctrl", "Alt", "F", "/", which are recognizable to the end-user. Great for game programmers.

Inputs
KeyCode as Integer

Assumes
If the user presses Shift+3, the function will not return "#", but will return "3" instead. It also uses easily recognizable symbols to represent certain keys, e.g "~" instead of "`", "\" instead of "|", and "Pg Dn", "Enter", "Space", to represent other keys.

Returns
KeyStr as String

Side Effects
If a key inputted does not match with any of the strings listed, the string returned will be "!".

Rate A KeyCode to Strings Converter (7(7 Vote))
A KeyCode to Strings Converter.bas

A KeyCode to Strings Converter Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters