Method 1.
Environment env
Integer resp
String temp, ls_version
Resp = getenvironment (env)
Choose case env. ostype
Case aix!
Temp = AIX
Case hpux!
Temp = HPUX
Case macintosh!
Temp = MacIntosh
Case osf1!
Temp = OSF1
Case sol2!
Temp = Solaris 2
Case Windows!
Temp = Windows
Case Windowsnt!
Temp = Windows NT
End choose
Ls_version = temp ++ string (env. osmajorrevision) +. + string (env. osminorrevision) +. + string (env. osfixesrevision)
Messagebox ("Windows version", ls_version)
Each operating system has its own version number. You can run it on a different operating system and switch it to a windows Name you are familiar.
Method 2.
Long L1
Dec {2} ldc_WinVer
String ls_WinVer
L1 = GetVersion ()
Ldc_WinVer = MOD (intlow (L1), 256) + int (intlow (L1)/256)/100
Choose case ldc_WinVer
Case 1, 3.10
Ls_WinVer = "Windows 3.x"
Case 4
Ls_WinVer = "Windows NT 4.0"
Case 1, 4.10
Ls_WinVer = "Windows 98"
Case 5
Ls_WinVer = "Windows 2000"
Case 1, 5.01
Ls_WinVer = "Windows XP"
Case 1, 5.02
Ls_WinVer = "Windows 2003"
End choose
Messagebox ("Windows version", ls_WinVer)
---------------------------------------------------------------
The following is a function.
// Function: gf_getos ()
// Description: Get current OS name
// Arguments: value integer
// Returns: string
// 95-98: Windows
// 2000-: WindowsNT
// Else :""
// Author: Kilojin Date: 2005.02.14
// Modify History:
//
Environment env
Integer rtn
Rtn = GetEnvironment (env)
IF rtn <> 1 then return ""
Choose case env. OSType
CASE Windows!
// Windows 95 or 98 code
Return "Windows"
CASE WindowsNT!
// Windows NT-specific code
Return "WindowsNT"
CASE Sol2!
IF env. OSMinorRevision = 5 THEN
RETURN ""
ELSEIF env. OSMinorRevision = 6 THEN
// Solaris 2.6 code
RETURN ""
END IF
CASE ELSE
RETURN ""
END CHOOSE