This information is also included with the Help file provided with the Standard and Professional Editions of Microsoft Visual Basic for MS-DOS, version 1.0.
For a standard keyboard, CTRL+BREAK is defined as follows
KEY n, CHR$(&H04) + CHR$(&H46)
On an enhanced keyboard, CTRL+BREAK is defined as follows:
KEY n, CHR$(&H84) + CHR$(&H46)
Examples of trapping CTRL+BREAK and CTRL+C (when the SHIFT, ALT, NUM LOCK, or CAPS LOCK keys are NOT active) are included below.
- From the File menu, choose New Project.
- Copy the code example to the Code window.
- Press F5 to run the program.
Code Example 1
KEY 15, CHR$(&H84) + CHR$(&H46) ' Traps CTRL+BREAK on enhanced keyboard.
KEY 16, CHR$(&H4) + CHR$(&H46) ' Traps CTRL+BREAK on standard keyboard.
ON KEY(16) GOSUB trap
ON KEY(15) GOSUB trap
FOR i = 1 TO 500
ID do Artigo: 33034 - Última Revisão: 16 de ago de 2005 - Revisão: 1