Detecting Windows Version?

BlitzPlus Forums/BlitzPlus Programming/Detecting Windows Version?

Hi Shane,

Here's a good way:
; Userlib declaration
.lib "Kernel32.dll" 
GetVersionEx%(VersionInfo*):"GetVersionExA"


; Blitz code for querying platform
Version = CreateBank(148)
PokeInt(Version, 0, BankSize(Version))
If GetVersionEx(Version) Then
	Select PeekInt(Version, 16)
		Case 0 : Notify "You are running Windows 3.1"
		Case 1 : Notify "You are running on the Windows 9x kernel"
		Case 2 : Notify "You are running on the Windows NT kernel"
		Default : Notify "Unexpected value for Platform ID.", True
	End Select
Else
	Notify "There was an error querying version info.", True
EndIf


For info, see here:
GetVersionEx
and here:
OSVERSIONINFO data structure

Ask away if you have any questions. =)