SHARE
TWEET

Untitled

a guest Sep 18th, 2010 200 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Private Type OSVERSIONINFO
  4.  dwOSVersionInfoSize As Long
  5.  dwMajorVersion As Long
  6.  dwMinorVersion As Long
  7.  dwBuildNumber As Long
  8.  dwPlatformId As Long
  9.  szCSDVersion As String * 128
  10. End Type
  11. Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
  12.  
  13. Public Function GetWindowsVersion() As String
  14.  Dim version As String
  15.  Dim os As OSVERSIONINFO 'receives version information
  16. Dim retval As Long 'return value
  17. os.dwOSVersionInfoSize = Len(os) 'set the size of the structure
  18. retval = GetVersionEx(os) 'read Windows's version information
  19. version = os.dwPlatformId & "." & os.dwMajorVersion & "." & os.dwMinorVersion
  20.  Select Case version
  21.   Case "1.4.0"
  22.    GetWindowsVersion = "Win 95"
  23.   Case "1.4.10"
  24.    GetWindowsVersion = "Win 98"
  25.   Case "1.4.98"
  26.    GetWindowsVersion = "Win ME"
  27.   Case "2.3.51"
  28.    GetWindowsVersion = "Win NT 3"
  29.   Case "2.4.0"
  30.    GetWindowsVersion = "Win NT 4"
  31.   Case "2.5.0"
  32.    GetWindowsVersion = "Win 2000"
  33.   Case "2.5.1"
  34.    GetWindowsVersion = "Win XP"
  35.   Case "2.6.0"
  36.    GetWindowsVersion = "Win Vista"
  37.   Case "2.6.1"
  38.    GetWindowsVersion = "Win Seven"
  39.   Case Else
  40.    GetWindowsVersion = "Unknown"
  41.  End Select
  42. End Function
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top