KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q28444: Example of Calling OS/2 DosGetVersion and DosGetMachineMode

Article: Q28444
Product(s): See article
Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | | mspl13_basic
Last Modified: 2-FEB-1990

Below is a sample program that makes calls to the OS/2 functions
DosGetVersion and DosGetMachineMode.

' The function declarations are found in BSEDOSPC.BI

DECLARE FUNCTION DosGetVersion%(_
        SEG P1 AS INTEGER)

DECLARE FUNCTION DosGetMachineMode(_
        BYVAL P1s AS INTEGER,_
        BYVAL P1o AS INTEGER)

DEFINT A-Z
CLS
DIM mode AS STRING*1

x=DosGetMachineMode%(varseg(mode),varptr(mode))
IF (x) THEN
   Print "An error occurred. The number is : ";x
ELSE
   IF mode=chr$(0) THEN
      print "Real Mode"
   ELSE
      print "Protect Mode"
   END if
END IF

x=DosGetVersion(version)
IF (x) THEN
   Print "An error occurred. The number is : ";x
ELSE
   Print "The version number is : ";
   Print  peek(varptr(version)+1);".";peek(varptr(version))
END IF

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.