Make your own free website on

Detect Windows Version

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Add 1 CommandButton to your form (named Command1),
'To see windows version press the button.
'Insert the following code to your module:

Type OsVersionInfo
dwVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatform As Long
szCSDVersion As String * 128
End Type
Declare Function GetVersionEx& Lib "kernel32" Alias _
"GetVersionExA" (lpStruct As OsVersionInfo)

'Insert the following code to your form:

Private Sub Command1_Click()
Dim OsVers As OsVersionInfo
OsVers.dwVersionInfoSize = 148&
GetVersionEx OsVers
If OsVers.dwPlatform = 0& Then
MsgBox "3.11"
ElseIf OsVers.dwPlatform = 1& Then
MsgBox "95"
ElseIf OsVers.dwPlatform = 2& Then
MsgBox "NT"
MsgBox "Unknown"
End If
End Sub

Go Back