OS Detection?

BlitzPlus Forums/BlitzPlus Programming/OS Detection?

thalamus(Posted 2006) [#1]
Is there a way to detect which O/S is installed?

I'm having trouble getting my toolbars (which work fine under Win2K) to work under XP, but if I know which O/S is installed I can work around the problem (ie. the value returned by the toolbar icon is 1 less in XP).


kfprimm(Posted 2006) [#2]
GetEnv("OS")


Cold Harbour(Posted 2006) [#3]
I have Xp Pro and this command returns 'Windows_NT'.


Alaric(Posted 2006) [#4]
Also, on a win98 machine, there is no such OS Environment variable.


xlsior(Posted 2006) [#5]
Also, on a win98 machine, there is no such OS Environment variable.


...which means that if there is no variable present, you know that you're on 95 or 98. (Not sure if Windows ME has it or not)

other differences: windows 2000 uses a default installation folder of c:\winnt, while XP uses c:\windows

you can tell 2000 and NT4 apart because 2000 also has a variable named 'appdata" which NT4 does not.


b32(Posted 2006) [#6]
There is also a windows api GetVersionEx: http://www.blitzbasic.com/Community/posts.php?topic=41041