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.
Article Q33034, Example 1
◄Contents► ◄Index► ◄Back►
─────────────────────────────────────────────────────────────────────────────
◄Knowledge Base Contents► ◄Knowledge Base Index►
How to Trap CTRL+BREAK on Standard & Enhanced Keyboard - Example 1
Code Example 1
--------------
Use the following steps to execute the examples listed below in
VBDOS.EXE:
1. From the File menu, choose New Project.
2. Copy the code example to the Code window.
3. Press F5 to run the program.
Use the following code to trap a CTRL+BREAK on either keyboard (standard
or extended):
KEY 15, CHR$(&H84) + CHR$(&H46) 'Traps CTRL+BREAK on enhanced keyboard.
KEY 16, CHR$(&H4) + CHR$(&H46) 'Traps CTRL+BREAK on standard keyboard.
KEY(15) ON
KEY(16) ON
ON KEY(16) GOSUB trap
ON KEY(15) GOSUB trap
FOR i = 1 TO 500
PRINT i
NEXT
END
trap:
PRINT "trapped"
RETURN