Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long Private Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128 ' Maintenance string for PSS usage End Type Private Function getverswindows() As String Dim version As String Dim os As OSVERSIONINFO ' receives version information Dim retval As Long ' return value os.dwOSVersionInfoSize = Len(os) ' set the size of the structure retval = GetVersionEx(os) ' read Windows's version information version = os.dwPlatformId & "." & os.dwMajorVersion & "." & os.dwMinorVersion Select Case version Case "1.4.0" GetWindowsVersion = "Win 95" Case "1.4.10" GetWindowsVersion = "Win 98" Case "1.4.98" GetWindowsVersion = "Win ME" Case "2.3.51" GetWindowsVersion = "Win NT 3" Case "2.4.0" GetWindowsVersion = "Win NT 4" Case "2.5.0" GetWindowsVersion = "Win 2000" Case "2.5.1" GetWindowsVersion = "Win XP" Case "2.6.0" GetWindowsVersion = "Win Vista" Case "2.6.1" GetWindowsVersion = "Win Seven" Case Else GetWindowsVersion = "Unknown" End Select End Function
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Function getverswindows() As String Dim version As String Dim os As OSVERSIONINFO ' receives version information Dim retval As Long ' return value os.dwOSVersionInfoSize = Len(os) ' set the size of the structure retval = GetVersionEx(os) ' read Windows's version information version = os.dwPlatformId & "." & os.dwMajorVersion & "." & os.dwMinorVersion Select Case version Case "1.4.0" GetWindowsVersion = "Win 95" Case "1.4.10" GetWindowsVersion = "Win 98" Case "1.4.98" GetWindowsVersion = "Win ME" Case "2.3.51" GetWindowsVersion = "Win NT 3" Case "2.4.0" GetWindowsVersion = "Win NT 4" Case "2.5.0" GetWindowsVersion = "Win 2000" Case "2.5.1" GetWindowsVersion = "Win XP" Case "2.6.0" GetWindowsVersion = "Win Vista" Case "2.6.1" GetWindowsVersion = "Win Seven" Case Else GetWindowsVersion = "Unknown" End Select getverswindows = GetWindowsVersion End Function