Believe me, the more advanced you get the more you need this. I don't like adding dll's to my software when I can do it in my own code. The newbies may not find this useful but I do.
Type Booger
dwOSVersionInfoSize As dword
dwMajorVersion As dword
dwMinorVersion As dword
dwBuildNumber As dword
dwPlatformId As dword
szCSDVersion As String
EndType
b as dword
c as dword
e as dword
g as dword
i as dword
k as dword
OSVI as Booger
make memblock 1, 148
for a=0 to 147
write memblock byte 1,a,0
next a
b=get memblock ptr(1)
load dll "kernel32.dll",1
*b=148
*b=call dll (1,"GetVersionExA",b)
delete dll 1
OSVI.dwOSVersionInfoSize=*b
c=b+4
OSVI.dwMajorVersion=*c
e=c+4
OSVI.dwMinorVersion=*e
g=e+4
OSVI.dwBuildNumber=*g
i=g+4
OSVI.dwPlatformId=*i
k=i+4
OSVI.szCSDVersion=chr$(*k)
Delete MemBlock 1
if OSVI.dwOSVersionInfoSize=0 then print "Version Check Failed":goto ending: else gosub checkVersion
print
print OSVI.dwMajorVersion;" ";OSVI.dwMinorVersion;" ";OSVI.dwBuildNumber;" ";OSVI.dwPlatformId;" ";OSVI.szCSDVersion
ending:
do
loop
checkVersion:
if osvi.dwMajorVersion = 5 and osvi.dwMinorVersion = 2
print "Microsoft Windows Server 2003, ";
endif
if osvi.dwMajorVersion = 5 and osvi.dwMinorVersion = 1
print "Microsoft Windows XP ";
endif
if osvi.dwMajorVersion = 5 and osvi.dwMinorVersion = 0
print "Microsoft Windows 2000 ";
endif
if osvi.dwMajorVersion < 4
print "Microsoft Windows NT ";
endif
if osvi.dwMajorVersion = 4 and osvi.dwMinorVersion = 0
print "Microsoft Windows 95 ";
if osvi.szCSDVersion = "C" or osvi.szCSDVersion = "B"
print "OSR2 ";
endif
endif
if osvi.dwMajorVersion = 4 and osvi.dwMinorVersion = 10
print "Microsoft Windows 98 ";
if osvi.szCSDVersion = "A"
print "SE ";
endif
endif
if osvi.dwMajorVersion = 4 and osvi.dwMinorVersion = 90
print "Microsoft Windows Millennium Edition ";
endif
return