Older Version
Newer Version
bshipps64
Feb 18, 2006
- "First created"
BuildOSVersionString$
Simple example of compiling a descriptive string of the OS version.print BuildOSVersionString$()
end
function BuildOSVersionString$()
success = GetOSVersionInfo(major, minor, build, platform, csdv$)
if (success) then
win$ = "Windows "
platfrm$ = str$(platform)
major$ = str$(major) + "."
minor$ = str$(minor) + "."
build$ = str$(build) + " "
if (major = 6) then
os$ = "Vista or Server " + chr$(34) + "Longhorn" + chr$(34)
else
select case (minor)
case (0)
if (major = 5) then os$ = "2000"
if (major = 4) then os$ = word$("95 NT", platform)
case (1)
os$ = "XP"
case (2)
os$ = "Server 2003, Server 2003 R2, or XP Professional x64 Edition"
case (10)
os$ = "98"
case (90)
os$ = "Me"
end select
end if
os$ = os$ + " "
end if
BuildOSVersionString$ = win$ + os$ + major$ + minor$ + build$ + csdv$
end function
function GetOSVersionInfo(byref majV, byref minV, byref build, byref plat, byref csdV$)
struct OSVERSIONINFOA,_
dwOSVersionInfoSize as ulong,_
dwMajorVersion as ulong,_
dwMinorVersion as ulong,_
dwBuildNumber as ulong,_
dwPlatformID as ulong,_
szCSDVersion as char[128]
OSVERSIONINFOA.dwOSVersionInfoSize.struct = len(OSVERSIONINFOA.struct)
calldll #kernel32, "GetVersionExA",_
OSVERSIONINFOA as struct,_
GetOSVersionInfo as boolean
if (GetOSVersionInfo) then
majV = OSVERSIONINFOA.dwMajorVersion.struct
minV = OSVERSIONINFOA.dwMinorVersion.struct
build = OSVERSIONINFOA.dwBuildNumber.struct
plat = OSVERSIONINFOA.dwPlatformID.struct
csdV$ = OSVERSIONINFOA.szCSDVersion.struct
end if
end function