Category : BASIC Source Code
Archive   : QBFAQR01.ZIP
Filename : USEKEYB.BAS

 
Output of file : USEKEYB.BAS contained in archive : QBFAQR01.ZIP
'To use cursor keys and function keys, etc ...

DO
'Get a key from the keyboard
DO
A$ = INKEY$
LOOP UNTIL LEN(A$)
'Check if it's a extended (special) key
IF LEN(A$) = 2 THEN
'If it is then, make the key code negative
KY = -ASC(RIGHT$(A$, 1))
ELSE
'If normal (within ASCII 1 - 255 range), then make it positive
KY = ASC(A$)
END IF

'Un-comment the following line to test for keycodes
'PRINT KY 'This will give you a specific number to put into your
' SELECT CASE structure for the key you pressed

'Use SELECT CASE structure to test for keys
SELECT CASE KY
CASE 27 'ESC key pressed
EXIT DO 'bail out
'Now you can do whatever you want to the key
'CASE ..., etc ...
END SELECT
LOOP 'Infinite loop, bail out when ESC pressed (in SELECT)


  3 Responses to “Category : BASIC Source Code
Archive   : QBFAQR01.ZIP
Filename : USEKEYB.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/