REM Example to detect windows/dos v1.0a PD 2006.

REM $INCLUDE: 'qbx.bi'

COMMON SHARED InregsX AS RegTypeX, OutregsX AS RegTypeX

'Windows 98:
' Int2Fh 160Ah = AX=0000h windows detected
' Int2Fh 4A33h = AX=0000h ms-dos detected

'Windows XP:
' Int2Fh 160Ah = AX=160Ah  windows not detected
' Int2Fh 4A33h = AX=4A33h  ms-dos not detected

'DOS 7.00:
' Int2Fh 160Ah = AX=160Ah  windows not detected
' Int2Fh 4A33h = AX=0000h  ms-dos detected

' default to windows
Windows.Detected = -1

' detect windows/dos
InregsX.AX = &H160A
CALL InterruptX(&H2F, InregsX, OutregsX)
IF OutregsX.AX > 0 THEN
   InregsX.AX = &H4A33
   CALL InterruptX(&H2F, InregsX, OutregsX)
   IF OutregsX.AX = 0 THEN
      Windows.Detected = 0 ' DOS 7.00
   END IF
END IF
IF Windows.Detected THEN
   PRINT "Windows detected."
ELSE
   PRINT "DOS 7.00 loaded."
END IF
