Here is an example:
VB Code:
  1. Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
  2. Private Type OSVERSIONINFO
  3.     dwOSVersionInfoSize As Long
  4.     dwMajorVersion As Long
  5.     dwMinorVersion As Long
  6.     dwBuildNumber As Long
  7.     dwPlatformId As Long
  8.     szCSDVersion As String * 128
  9. End Type
  10. Private Sub Form_Load()
  11.     Dim OSInfo As OSVERSIONINFO, PId As String
  12. 'Set the graphical mode to persistent
  13.     Me.AutoRedraw = True
  14.     'Set the structure size
  15.     OSInfo.dwOSVersionInfoSize = Len(OSInfo)
  16.     'Get the Windows version
  17.     Ret& = GetVersionEx(OSInfo)
  18.     'Chack for errors
  19.     If Ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub
  20.     'Print the information to the form
  21.     Select Case OSInfo.dwPlatformId
  22.         Case 0
  23.             PId = "Windows 32s "
  24.         Case 1
  25.             PId = "Windows 95/98"
  26.         Case 2
  27.             PId = "Windows NT "
  28.     End Select
  29.     Print "OS: " + PId
  30.     Print "Win version:" + str$(OSInfo.dwMajorVersion) + "." + LTrim(str(OSInfo.dwMinorVersion))
  31.     Print "Build: " + str(OSInfo.dwBuildNumber)
  32. End Sub