I've just written a procedure to determine the version of windows someone is running. It works on my machine but I need to test it on different versions of Windows.
Procedure.s WindowsVersion()
Version.OSVERSIONINFO
Version\dwOSVersionInfoSize=SizeOf(OSVERSIONINFO)
GetVersionEx_(Version)
Select Version\dwMajorVersion
Case 4 ;Windows NT 4.0, Windows Me, Windows 98, or Windows 95
Select Version\dwMinorVersion
Case 10
ProcedureReturn "Windows 98"
Case 90
ProcedureReturn "Windows ME"
Default
If Version\dwPlatformID=#VER_PLATFORM_WIN32_WINDOWS
ProcedureReturn "Windows 95"
EndIf
EndSelect
Case 5 ;Windows Server 2003, Windows XP, or Windows 2000
Select Version\dwMinorVersion
Case 1
ProcedureReturn "Windows XP"
Case 2
ProcedureReturn "Windows Server 2003"
Default
ProcedureReturn "Windows 2000"
EndSelect
EndSelect
EndProcedure
MessageRequester("Version",WindowsVersion())
Could you please test this on your computer, then post the result and your actual OS.
Thanks a lot!
(BTW: Proceedure is free for anyone to use, can't gaurentee it'll work 100% atm).
~I see one problem with your reasoning: the fact is thats not a chicken~
I'm writing my own (interpreted) BASIC variant in PureBasic. As I am not allowed to wrap any of PBs existing commands (according to the licence and a thread I made about the topic) I basically have to write each of the commands from scratch.
This is where this procedure comes in.
~I see one problem with your reasoning: the fact is thats not a chicken~
Win XP Pro returns Windows XP.
Win 2K Pro returns Windows 2000.
Win 98 SE returns Windows 98.
Win ME returns Windows ME.
Not tested on 95 or NT as I don't have them installed at the moment (obsolete).
If you really need to know the results, let me know and I'll install them...
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Procedure.s WindowsVersion()
Version.OSVERSIONINFO
Version\dwOSVersionInfoSize=SizeOf(OSVERSIONINFO)
GetVersionEx_(Version)
Select Version\dwMajorVersion
Case 4 ;Windows NT 4.0, Windows Me, Windows 98, or Windows 95
Select Version\dwMinorVersion
Case 10
ProcedureReturn "Windows 98"
Case 90
ProcedureReturn "Windows ME"
Default
If Version\dwPlatformID = #VER_PLATFORM_WIN32_WINDOWS
ProcedureReturn "Windows 95"
ElseIf Version\dwPlatformID = #VER_PLATFORM_WIN32_NT
ProcedureReturn "Windows NT"
Else
ProcedureReturn "Unknown OS"
EndIf
EndSelect
Case 5 ;Windows Server 2003, Windows XP, or Windows 2000
Select Version\dwMinorVersion
Case 0
ProcedureReturn "Windows 2000"
Case 1
ProcedureReturn "Windows XP"
Case 2
ProcedureReturn "Windows Server 2003"
Default
ProcedureReturn "Unknown OS"
EndSelect
Case 6 ;Windows Server "Longhorn" or "Microsoft Windows Vista"
Select Version\dwMinorVersion
Case 0
If Version\dwPlatformID = #VER_PLATFORM_WIN32_NT
ProcedureReturn "Microsoft Windows Vista"
Else
ProcedureReturn "Windows Server Longhorn"
EndIf
Default
ProcedureReturn "Unknown OS"
EndSelect
EndSelect
EndProcedure
MessageRequester("Version",WindowsVersion())
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Not sure if I still have my vista cd but if it hasn't shown up in a day or so I'll see if i can re-install it (it's pretty much useless, that's why I overwrote the partition).