I've read quite a few posts on detecting function keys using special libraries. Is it possible to read the hex value of the key intead of using a library?

I basically want to end up with an if statement that accepts user input until <TAB>, or hex value 9, is pressed - at which point the program ends. I can't seem to capture the hex value correctly.

Thanks,