DECLARE FUNCTION DQBkey (BYVAL ScanCode)
ScanCode - Scancode of the key to retrieve status of
True if the key is pressed, otherwise false
This function returns useful information only when the custom keyboard interrupt handler has been installed by calling DQBinstallKeyboard. For a complete list of keyboard scancodes, refer to appendix B. There're also a few constants declared into the file DIRECTQB.BI, such as KEYESC, KEYENTER, KEYUP, KEYDOWN, KEYLEFT, KEYRIGHT and others, explained into appendix A.
none
*****************************************************************************
' All integers for speed
DEFINT A-Z
'$INCLUDE:'DIRECTQB.BI'
' Let's initialize the library with no extra layers nor sounds nor EMS
IF DQBinit(0, 0, 0) THEN DQBclose: PRINT DQBerror$: END
' Let's install the custom keyboard handler
DQBinstallKeyboard
CLS
PRINT "Keyboard demo - press any key to see its scancode. Multiple
keypresses are allowed; press ESC to exit."
DO
LOCATE 3, 1
' Scans every possible key
FOR i = 0 TO 127
' If the key is pressed, prints its scancode
IF DQBkey(i) THEN PRINT "[" + LTRIM$(STR$(i)) + "] ";
NEXT i
' Clears a portion of the screen
PRINT SPACE$(40)
' Loops while the ESC key is not pressed
LOOP UNTIL DQBkey(KEYESC)
' Uninstalls the keyboard handler (this is not really needed when we're
' going to end the program by calling DQBclose)
DQBremoveKeyboard
' Ends program
DQBclose
*****************************************************************************