Using CALL INTERRUPT to Return DOS Version Number (45170)



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 for MS-DOS 7.0

This article was previously published under Q45170

SUMMARY

The program shown below demonstrates how to use CALL INTERRUPT to return the DOS version number.

This information applies to Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50 and to the Microsoft Basic Compiler Versions 6.00, and 6.00b for MS-DOS, and to Microsoft Basic PDS Version 7.00 for MS-DOS.

The following program is INTVER.BAS:
' $INCLUDE: 'qb.bi'
' For BC.EXE and QBX.EXE in Basic 7.00 the include is 'QBX.BI'

DIM inregs AS RegType, outregs AS RegType
inregs.ax = &H3000
CALL INTERRUPT(&H21, inregs, outregs)
majorver = outregs.ax AND &HFF
minorver = (outregs.ax AND &HFF00) / 256
PRINT "MS-DOS Version: "; majorver; "."; minorver

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB45170 kbAudDeveloper