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 ' Maintenance string for PSS usage 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 "Sorry, Windows 95 or NT4 or later required!", _ vbInformation, "This program is gone!" End Else Debug.Print "OK. We're in! 95 or NT4..." Select Case OS.dwPlatformId Case VER_PLATFORM_WIN32_WINDOWS MsgBox "Win 32 and Windows 95 running!", _ vbInformation, "Visual Basic 5 SECRETS" Case VER_PLATFORM_WIN32_NT MsgBox "Windows NT Version" & Str(OS.dwMajorVersion) & _ " Build " & Str(OS.dwBuildNumber) & " running!", _ vbInformation, "Visual Basic 5 SECRETS" Case Else MsgBox "Clueless!", _ vbInformation, "Visual Basic 5 SECRETS" End Select End If End Sub |