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
End Type
Private Sub Form_Load()
Dim nSysVer As Long
Dim osInfo As OSVERSIONINFO
Dim ret&
osInfo.dwOSVersionInfoSize = Len(osInfo)
'Get the Windows version
ret& = GetVersionEx(osInfo)
'Chack for errors
If ret& = 0 Then
MsgBox "Error Getting Version Information"
Else
nSysVer = osInfo.dwPlatformId
MsgBox nSysVer '=2就是2000,=1就是98
End If