CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002
    Location
    CT
    Posts
    132

    Windows version stored in registry? *Solved*

    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
    Last edited by kanji2150; September 24th, 2003 at 09:20 AM.

  2. #2
    Join Date
    May 2002
    Location
    Montreal
    Posts
    450
    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.
    Cheers,
    Laurent

    For an aviator, the three best things in life are a good landing, a good orgasm, and a good sh*t. A night carrier landing is one of the few opportunities to experience all three at the same time.

  3. #3
    Join Date
    Nov 2002
    Location
    CT
    Posts
    132
    Thanks alot! It works perfectly. Thanks for responding so quickly!

  4. #4
    Join Date
    Feb 2001
    Location
    PA
    Posts
    163
    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
    Last edited by Cimperiali; September 24th, 2003 at 12:33 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured