BCX Console Demonstration Program s101.bas

 ' ============================================================================ 
 '  GetVersionEx may be altered or unavailable for releases after Windows 8.1.  
 '  therefore this demo may not work as expected.                               
 ' ============================================================================ 
 
 PRINT OsVersion$(), " detected"
 
 FUNCTION OsVersion$()
   DIM os AS OSVERSIONINFO
   os.dwOSVersionInfoSize = SIZEOF(os)
   IF GetVersionEx(&os) THEN
     SELECT CASE os.dwPlatformId
     CASE 1
       IF os.dwMinorVersion = 0 THEN
         IF os.szCSDVersion[1] <> 66 AND os.szCSDVersion[1] <> 67 THEN
           FUNCTION = "Windows 95"
         END IF
         IF os.szCSDVersion[1] = 66 OR os.szCSDVersion[1] = 67 THEN
           FUNCTION = "Windows 95 OSR2"
         END IF
       END IF
       IF os.dwMinorVersion = 10 THEN
         IF os.szCSDVersion[1] = 65 THEN
           FUNCTION = "Windows 98 Second Edition"
         END IF
         IF os.szCSDVersion[1] <> 65 THEN
           FUNCTION = "Windows 98"
         END IF
       END IF
       IF os.dwMinorVersion = 90 THEN
         FUNCTION = "Windows Millennium"
       END IF
     CASE 2 '  Windows NT 3.51 
       IF os.dwMajorVersion = 3 THEN
         FUNCTION = "Windows NT 3.51"
       END IF
       IF os.dwMajorVersion = 4 THEN
         FUNCTION = "Windows NT 4.0"
       END IF
       IF os.dwMajorVersion = 5 THEN
         IF os.dwMinorVersion = 0 THEN
           FUNCTION = "Windows 2000"
         END IF
         IF os.dwMinorVersion = 1 THEN
           FUNCTION = "Windows XP"
         END IF
       END IF
     END SELECT
   END IF
   FUNCTION = 0
 END FUNCTION

Result:


 Result not displayed for this example.