ex.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
KEY and ON KEY Statement Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' This example uses the KEY and ON KEY statements to trap the Ctrl+s (control
' key and lowercase "s") key combination.
 
' Note: This example requires Caps Lock and Num Lock to be off.
 
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the code example below to the code window
' 3. Press F5 to run the example
 
 CONST ESC = 27
 
 KEY 15, CHR$(&H4) + CHR$(&H1F)             ' Set up Ctrl+s as KEY 15
 ON KEY(15) GOSUB PauseHandler
 KEY(15) ON
 WHILE INKEY$ <> CHR$(ESC)
     PRINT "Press Esc to stop, Ctrl+s to pause."
     PRINT
 WEND
 END
 
PauseHandler:
     SLEEP 1
     RETURN