What is the virtual key code for ~/`

Hello sorry im a beginner programmer and I was just wondering what the virtual key code is for the ~/` key :).
By "~/` key" I assume you're talking about the key with the ~ and ` symbols on it.

If I further assume you're talking about a US keyboard layout, then VK_OEM_3 might be the one you're looking for.


Virtual-Key Codes

Worked like a charm thanks for the help!

p.s I did look at the Microsofts page but I couldn't find ~ key code :P
There is also a bit of a shortcut that you could use (I think it's called escape sequence), though I've heard some people discourage it, I'm not sure why;

/ = '\/'
~ = '\~`
" = '\"'
char key;
//process whatever input you use...

if(key == '\~')
    //the key pressed was ~
Last edited on
closed account (Dy7SLyTq)
though I've heard some people discourage it, I'm not sure why;

a) your escape sequence is incorrect and
b) it is discouraged because a lot of them are os specific


i dont think there is a \/ escape sequence either
Last edited on
Nope, you're right, no \/ escape key, I'd always assumed there was and had been typing it like that all this time. I'm self taught, stop laughing... :p
Oh well, I wasn't sure if I should have mentioned escape keys at all, thanks for the explanation why not to use them.
Last edited on
Topic archived. No new replies allowed.