TYPE OSVERSIONINFO
dwOSVersionInfoSize AS LONG
dwMajorVersion AS LONG
dwMinorVersion AS LONG
dwBuildNumber AS LONG
dwPlatformId AS LONG
szCSDVersion AS STRING * 128
END TYPE
CONST PLATFORM_WIN32=0
CONST PLATFORM_WIN32_WINDOWS=1
CONST PLATFORM_WIN32_NT=2
CONST PLATFORM_WIN32_CE=3
DECLARE FUNCTION GetLastError LIB "kernel32.dll" ALIAS "GetLastError" () AS LONG
DECLARE FUNCTION GetVersionEx LIB "kernel32.dll" ALIAS "GetVersionExA" (BYVAL lpVersionInformation AS LONG) AS LONG
DIM rtn AS LONG, FDouble AS DOUBLE, mmbp AS BYTE
DIM OSV AS OSVERSIONINFO, Mem AS QMEMORYSTREAM
SUB Get_Version
OSV.dwOSVersionInfoSize=SIZEOF(OSV)
Mem.WriteUDT(OSV)
rtn=GetVersionEx(Mem.Pointer)
IF rtn<>0 THEN
Mem.Position=0
Mem.ReadUDT(OSV)
OSV.dwBuildNumber=(OSV.dwBuildNumber AND &H0000FFFF)
IF OSV.dwPlatformId=PLATFORM_WIN32_WINDOWS THEN
IF OSV.dwMajorVersion=4 THEN
IF OSV.dwMinorVersion=10 THEN
IF OSV.dwBuildNumber=1998 THEN
mmbp=11
ELSEIF ((OSV.dwBuildNumber>1998) AND (OSV.dwBuildNumber<2183)) THEN
mmbp=12
ELSEIF OSV.dwBuildNumber>2182 THEN
mmbp=13
ELSE
mmbp=200
END IF
ELSEIF OSV.dwMinorVersion<10 THEN
IF OSV.dwBuildNumber=950 THEN
mmbp=1
ELSEIF ((OSV.dwBuildNumber>950) AND (OSV.dwBuildNumber<1081)) THEN
mmbp=2
ELSEIF OSV.dwBuildNumber>1080 THEN
mmbp=3
ELSE
mmbp=200
END IF
ELSEIF OSV.dwMinorVersion=90 THEN
IF OSV.dwBuildNumber=3000 THEN
mmbp=21
ELSE
mmbp=200
END IF
ELSE
mmbp=201
END IF
ELSE
mmbp=202
END IF
ELSEIF OSV.dwPlatformId=PLATFORM_WIN32_NT THEN
IF OSV.dwMajorVersion=3 THEN
IF OSV.dwMinorVersion=51 THEN
IF OSV.dwBuildNumber=1057 THEN
mmbp=31
ELSE
mmbp=200
END IF
ELSE
mmbp=201
END IF
ELSEIF OSV.dwMajorVersion=4 THEN
IF OSV.dwMinorVersion=0 THEN
IF OSV.dwBuildNumber=1381 THEN
mmbp=41
ELSE
mmbp=200
END IF
ELSE
mmbp=201
END IF
ELSEIF OSV.dwMajorVersion=5 THEN
IF OSV.dwMinorVersion=0 THEN
IF OSV.dwBuildNumber=2195 THEN
mmbp=51
ELSE
mmbp=200
END IF
ELSEIF OSV.dwMinorVersion=1 THEN
mmbp=61
ELSE
mmbp=201
END IF
ELSE
mmbp=202
END IF
ELSEIF OSV.dwPlatformId=PLATFORM_WIN32_CE THEN
ELSE
mmbp=203
END IF
ELSE
mmbp=204
END IF
END SUB
SUB Show_Version
IF mmbp=1 THEN
SHOWMESSAGE("Windows 95")
ELSEIF mmbp=2 THEN
SHOWMESSAGE("Windows 95 SP1")
ELSEIF mmbp=3 THEN
SHOWMESSAGE("Windows 95 OSR2")
ELSEIF mmbp=11 THEN
SHOWMESSAGE("Windows 98")
ELSEIF mmbp=12 THEN
SHOWMESSAGE("Windows 98 SP1")
ELSEIF mmbp=13 THEN
SHOWMESSAGE("Windows 98 SE")
ELSEIF mmbp=21 THEN
SHOWMESSAGE("Windows ME")
ELSEIF mmbp=31 THEN
SHOWMESSAGE("Windows NT 3.51")
ELSEIF mmbp=41 THEN
SHOWMESSAGE("Windows NT 4")
ELSEIF mmbp=51 THEN
SHOWMESSAGE("Windows 2000 / Windows 2000 Pro")
ELSEIF mmbp=61 THEN
SHOWMESSAGE("Windows XP")
ELSEIF mmbp=200 THEN
SHOWMESSAGE("Unknown Build Number")
ELSEIF mmbp=201 THEN
SHOWMESSAGE("Unknown Minor Version")
ELSEIF mmbp=202 THEN
SHOWMESSAGE("Unknown Major Version")
ELSEIF mmbp=203 THEN
SHOWMESSAGE("Unknown Windows Platform")
ELSEIF mmbp=204 THEN
SHOWMESSAGE(STR$(getlasterror())+" "+STR$(rtn))
ELSE
SHOWMESSAGE("Example.exe Does not work on your Machine!")
END IF
END SUB
Get_Version
Show_Version
|