home *** CD-ROM | disk | FTP | other *** search
- ' KEY.ASC -- MSDOS QuickBASIC test program for the GETKEY.SUB subroutines
-
- ' Compile syntax: BASCOM KEY.ASC /D; | LINK KEY;
-
- PRINT "GETKEY.SUB test . . ."
- GOSUB GETKEY.PRESS
- CLS
- PRINT "Well, GETKEY.PRESS seems to work"
- PRINT
- TEMP$ = ""
-
- PRINT "Type in a short string "
- LINE INPUT "of mixed-case characters: ";IN$
-
- ' Loop to convert a string to all CAPS
- FOR I = 1 TO LEN(IN$)
- Q$= MID$(IN$,I)
- GOSUB GETKEY.CAPS
- TEMP$ = TEMP$ + Q$
- NEXT
-
- PRINT
- PRINT "Here's your string in all CAPS:"
- PRINT
- PRINT TAB (40 - LEN(TEMP$)/2) TEMP$
- GOSUB GETKEY.PRESS
-
- LOCATE 16,10
- PRINT "In this last test, press any key"
-
- LOOP:
- LOCATE 18,1
- PRINT " Press <ESC> to exit this test and the program"
- PRINT "Press a key . ."
-
- ' You can mix line numbers with line names
- 1 Q$ = INKEY$
- IF Q$ = "" _
- THEN 1
-
- ' Get the extended key code & ASCII code of the key just pressed
- GOSUB GETKEY.CODE
- PRINT "ASCII key code is";K.CODE
- PRINT " Extended code is";E.CODE
- PRINT " Character is ";CHR$(K.CODE)
- DLY = 2 ' 2 seconds delay
- GOSUB DELAY
- CLS
-
- WHILE INKEY$ <> "" ' Clear the keyboard buffer
- WEND
-
- IF K.CODE = 27 _
- AND E.CODE = 0 _
- THEN GOTO LOOP.XIT _
- ELSE GOTO LOOP
-
- LOOP.XIT:
- COLOR 14 , 3 , 8 'My normal screen colors
- CLS ' change to your preference
- SYSTEM
-
- REM $INCLUDE: 'GETKEY.SUB'
- REM $INCLUDE: 'DELAY.SUB'
- ' >>>>> Physical EOF