''How to get OS Info in VB ?
Option Explicit
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type'in module or gen decl.
Public Declare Function GetVersionExA Lib "kernel32" _(lpVersionInformation As OSVERSIONINFO) As Integer
' function to get OS Version
Public Function getosVersion() As String
Dim osInfo As OSVERSIONINFODim lRV As Integer
osInfo.dwOSVersionInfoSize = 148
osInfo.szCSDVersion = Space$(128)
lRV = GetVersionExA(osInfo)
With osInfo
Select Case .dwPlatformId
Case 1
If .dwMinorVersion = 0
Then getosVersion = "95"
ElseIf .dwMinorVersion = 10
Then getosVersion = "98"
End
IfCase 2
If .dwMajorVersion = 3 Then
getosVersion = "3.51"
ElseIf .dwMajorVersion = 4 Then
getosVersion = "4.0"
ElseIf .dwMajorVersion = 5 Then
If .dwMinorVersion = 0 Then
getosVersion = "2000"
ElseIf .dwMinorVersion = 1 Then
getosVersion = "WinXP/.NET Server"
End If
End If
Case Else getosVersion = "Failed"
End Select
End With
End Function
''End here
0 comments
Post a Comment