Fastest way to get Keyboard presses

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Your number is printed many times because it is using a semicolon after a PRINT that is not LOCATEd. What key is code 2 or 3 anyhow? You would need 128 cases for just keypresses alone!

The idea to learn INP(&H60) is to find out what keypress creates what code.

You can find many of the keys with 2 byte ASCII codes like CHR$(0) + CHR(asciicode) using INKEY instead. Try the arrow keys.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Sinuvoid
Veteran
Posts: 155
Joined: Wed Jul 25, 2007 8:20 am

Post by Sinuvoid »

ok, so overall, dont use it :P kk thanks burger, everyone else :)
Post Reply