Here's what I've managed to come up with and it works fine on my Vista computer...
I'm not sure how memory safe simply increasing the size of the type is as the system will be writing to memory outside the type structure. I tried to use a byte array to pad out the type but it simply stores a 1 byte memory pointer (I think because Max doesn't support type static arrays). :-?
Hope this helps,
Seb
SuperStrict Notify GetWindowsVersion() Function GetWindowsVersion$() ?Win32 Extern "Win32" Function GetVersionExW:Int(osVersion:Byte Ptr) EndExtern Type OSVERSIONINFO Field dwOSVersionInfoSize:Int Field dwMajorVersion:Int Field dwMinorVersion:Int Field dwBuildNumber:Int Field dwPlatformId:Int Field szCSDVersion:Short Ptr Method New() dwOSVersionInfoSize = SizeOf(Self) + 252 EndMethod EndType ? Local tmpOutput:OSVERSIONINFO = New OSVERSIONINFO If GetVersionExW(tmpOutput) Then Select tmpOutput.dwMajorVersion Case 6;Return "Windows Vista" Case 5 Select tmpOutput.dwMinorVersion Case 2;Return "Windows XP 64-bit / Windows Server 2003" Case 1;Return "Windows XP" Case 0;Return "Windows 2000" EndSelect Case 4 Select tmpOutput.dwMinorVersion Case 90;Return "Windows ME" Case 10;Return "Windows 98" Case 0;If tmpOutput.dwPlatformId = 2 Then Return "Windows NT 4.0" Else Return "WIndows 95" EndSelect EndSelect EndIf EndFunction
I'm not sure how memory safe simply increasing the size of the type is as the system will be writing to memory outside the type structure. I tried to use a byte array to pad out the type but it simply stores a 1 byte memory pointer (I think because Max doesn't support type static arrays). :-?
Hope this helps,
Seb