[windows] GetWindowVersion

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[windows] GetWindowVersion

Post by BackupUser »

Code updated for 5.20+

Restored from previous forum. Originally posted by Hi-Toro.

This will return a string with the version of Windows in use. NOTE: You might prefer to return the 'os\dwPlatformId' value instead...

Code: Select all

Procedure.s GetWindows ()
  
  os.OSVERSIONINFO
  os\dwOSVersionInfoSize = SizeOf (OSVERSIONINFO)
  
  GetVersionEx_ (os)
  
  Select os\dwPlatformId
    Case #VER_PLATFORM_WIN32_NT
      
      If (os\dwMajorVersion >= 5)
        win$ = "Windows 2000/XP"
      Else
        win$ = "Windows NT"
      EndIf
      
    Case #VER_PLATFORM_WIN32_WINDOWS
      
      If(os\dwMinorVersion < 10)
        win$ = "Windows 95"
      EndIf
      
    Default
      
      If (os\dwMinorVersion < 90)
        win$ = "Windows 98"
      Else
        win$ = "Windows ME"
      EndIf
      
  EndSelect
  
  ProcedureReturn win$
  
EndProcedure

MessageRequester ("", "Result: " + GetWindows (), #MB_ICONINFORMATION)
--
See ya,
James L Boyd.
http://www.hi-toro.com/
--