Quick question... is the version of Windows stored in a certain place in the registry? Also, is the current patch installed also stored in the registry anywhere? Thanks a lot guys, you are the best!
Jason Palmer
Printable View
Quick question... is the version of Windows stored in a certain place in the registry? Also, is the current patch installed also stored in the registry anywhere? Thanks a lot guys, you are the best!
Jason Palmer
For Windows 2000 and up, take a look at: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
You should be able to find all you need.
Thanks alot! It works perfectly. Thanks for responding so quickly!
Here's the code way just for fun! After all this is the "VB" forum.
Code:Option Explicit
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Private Type OSVERSIONINFO ' 148 Bytes
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private myVer As OSVERSIONINFO
Private Const VER_PLATFORM_WIN32_NT& = 2
Private Const VER_PLATFORM_WIN32_WINDOWS& = 1
'**************************************************
Private Function LPSTRToVBString$(ByVal s$)
Dim nullpos&
nullpos& = InStr(s$, Chr$(0))
If nullpos > 0 Then
LPSTRToVBString = Left$(s$, nullpos - 1)
Else
LPSTRToVBString = ""
End If
End Function
'**************************************************
Private Sub Command1_Click()
Dim flagnum&
Dim dl&, s$
Dim vernum&, verword%
' Get the windows flags and version numbers
myVer.dwOSVersionInfoSize = 148
dl& = GetVersionEx&(myVer)
If myVer.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then
s$ = " Windows95 "
ElseIf myVer.dwPlatformId = VER_PLATFORM_WIN32_NT Then
s$ = " Windows NT "
Else
s$ = " Windows 2000 "
End If
MsgBox s$ & myVer.dwMajorVersion & "." & myVer.dwMinorVersion & vbNewLine & " Build " & (myVer.dwBuildNumber And &HFFFF&) & vbNewLine & LPSTRToVBString(myVer.szCSDVersion)
End Sub