Do Not Use DOS Interrupts to Terminate Compiled Programs (32274)



The information in this article applies to:

  • Microsoft QuickBASIC 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBASIC 4.5
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0

This article was previously published under Q32274

SUMMARY

The following information applies to QuickBasic Versions 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.

Some DOS interrupts should not be invoked from QuickBasic programs. For example, "Terminate With Return Code" (Interrupt 21H, function 4CH) can cause loss of the cursor the first time it is executed, then a hard hang on a subsequent CALL.

QuickBasic must control its own termination to correctly return to DOS. Please use the END statement in Basic rather than a DOS interrupt to terminate a program.

MORE INFORMATION

The following is a code example:
'WARNING:
'Execution of the following code will result in unpredictable results,
'such as system lockup or loss of the DOS cursor in some instances.
DIM inarray%(7), outarray%(7)
inarray%(0) = &H4C00
CALL int86old(&H21, inarray%(), outarray%())
'The INT86OLD routine is located in QB.QLB and QB.LIB.
				

Modification Type:MinorLast Reviewed:1/8/2003
Keywords:KB32274