Option Explicit
Public Const VER_PLATFORM_WIN32_NT = 2 Public Const VER_PLATFORM_WIN32_WINDOWS = 1 Public Const VER_PLATFORM_WIN32s = 0 Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128 End Type Declare Function GetVersionEx Lib "kernel32" _ Alias "GetVersionExA" (lpVersionInformation As _ OSVERSIONINFO) As Long Public Sub Main() Dim OS As OSVERSIONINFO OS.dwOSVersionInfoSize = Len(OS) GetVersionEx OS If OS.dwMajorVersion < 4 Then MsgBox "Impossibile continuare! _ E' richiesto Win 9x o WinNt 4.x", _ vbInformation End Else Select Case OS.dwPlatformId Case VER_PLATFORM_WIN32_WINDOWS MsgBox "Windows 95" & Str(OS.dwMajorVersion) & _ " Build " & Str(OS.dwBuildNumber), vbInformation Case VER_PLATFORM_WIN32_NT MsgBox "Windows NT Versione" & Str(OS.dwMajorVersion) & _ " Build " & Str(OS.dwBuildNumber) , vbInformation End Select End If End Sub Con l'API GetVersionEx e' molto semplice rilevare il tipo di sistemo operativo (e la sua versione). Ecco come fare: |