You can do it with an API call or using the SysInfo control. Here's an example of both, and I've included a table with the identifying characteristics (where I know them):
[tt]
Option Explicit
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 Const VER_PLATFORM_WIN32s = 0 ' Win32s on Windows 3.1
Private Const VER_PLATFORM_WIN32_WINDOWS = 1 ' Windows 95, Windows 98, or Windows Me
Private Const VER_PLATFORM_WIN32_NT = 2 ' Windows NT, Windows 2000, Windows XP, or Windows Server 2003 family.
' Major Minor
' OS Platform Version Version Build
' Windows 95 1 4 0
' Windows 98 1 4 10 1998
' Windows 98SE 1 4 10 2222
' Windows Me 1 4 90 3000
' NT 3.51 2 3 51
' NT 2 4 0 1381
' 2000 2 5 0
' XP 2 5 1 2600
' Server 2003 2 5 2
Private Sub Command1_Click()
Dim OSInfo As OSVERSIONINFO
OSInfo.dwOSVersionInfoSize = Len(OSInfo)
' SysInfo version
If SysInfo1.OSPlatform = VER_PLATFORM_WIN32_WINDOWS Then ' OK, could be W98SE
If CInt(SysInfo1.OSVersion) = 4 Then ' OK, it is W98
If SysInfo1.OSBuild = 2222 Then
' Yep, we've found W98SE!
End If
End If
End If
'API Version
GetVersionEx OSInfo
If OSInfo.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then ' OK, could be W98SE
If OSInfo.dwMajorVersion = 4 Then
If (OSInfo.dwBuildNumber And &HFFFF) = 2222 Then ' Build number is in loword for w9x family
' Yep, we've found W98SE!
End If
End If
End If
End Sub