How to INPUT Text without CTRL+BREAK Stopping Execution (37163)
This article was previously published under Q37163
SUMMARY
When an INPUT or LINE INPUT statement is pending to accept text, the
program will always stop if you press CTRL+BREAK. CTRL+BREAK aborts
the program even when the program is compiled without the /D (debug)
option. [Pressing CTRL+BREAK will not stop programs compiled without
/D (debug) if no INPUT or LINE INPUT statement is currently pending.]
Also, events such as ON KEY(n) GOSUB key trapping and ON ERROR GOTO
error handling are suspended until the INPUT or LINE INPUT statement
is satisfied by pressing the ENTER key.
This behavior applies to Microsoft QuickBasic Versions 1.00, 1.01,
1.02, 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50; to Microsoft Basic
Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2; and to
Microsoft Basic PDS Version 7.00 for MS-DOS and MS OS/2.
You will need to use a method other than INPUT and LINE INPUT to both
suppress CTRL+BREAK and allow input, and to allow events to be handled
while input is taking place. The easiest method to use is a loop
structure that monitors the value of the INKEY$ function and makes the
appropriate changes to the input string. Below is an example of how to
write your own INPUT statement. For another example of how to write
your own INPUT statement, query on the following words:
QuickBasic and buffered and keyboard and input and cursor
Modification Type: |
Minor |
Last Reviewed: |
1/8/2003 |
Keywords: |
KB37163 |
|