Results 1 to 3 of 3

Thread: Quiet simple question - Windows version?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    Prague, Czech Republic
    Posts
    350

    Quiet simple question - Windows version?

    Very stupid question... how to determine, what kind of windows user has? W95/98/NT/2000/NET?

    I know GetVersion and GetVersionEx, but they return major version - the problem is both W95 and W98 have major version 4.

  2. #2
    Hyperactive Member techman2553's Avatar
    Join Date
    Mar 2001
    Location
    <- To your left.
    Posts
    362
    I'm sure there is an API to do this, but VB also has the SysInfo Control that gives you the Major/Minor revison info:

    Code:
    Private Sub Form_Load()
      Debug.Print SysInfo1.OSVersion
      Debug.Print SysInfo1.OSPlatform
      Debug.Print SysInfo1.OSBuild
    End Sub
    ----------

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Not sure how old this is and if it get's ME..but it's the API version and should give the general scope of things.
    Code:
    Private Type OSVERSIONINFO 
    dwOSVersionInfoSize As Long 
    dwMajorVersion As Long 
    dwMinorVersion As Long 
    dwBuildNumber As Long 
    dwPlatformId As Long 
    szCSDVersion As String * 128 ' Maintenance string for PSS usage 
    End Type 
    Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long 
    Private Const VER_PLATFORM_WIN32_NT = 2 
    Private Const VER_PLATFORM_WIN32_WINDOWS = 1 
    
    Public Function GetWindowsVersion() As String 
    Dim os As OSVERSIONINFO 
    Dim strVersion As String 
    Dim strSP As String 
    
    os.dwOSVersionInfoSize = Len(os) 
    os.szCSDVersion = Space(255) 
    Call GetVersionEx(os) 
    
    
    With os 
    Select Case .dwPlatformId 
    Case VER_PLATFORM_WIN32_WINDOWS 
    If .dwMinorVersion = 0 Then 
    strVersion = "Windows 95" 
    ElseIf .dwMinorVersion = 10 Then 
    strVersion = "Windows 98" 
    End If 
    
    Case VER_PLATFORM_WIN32_NT 
    If .dwMajorVersion = 3 Then 
    strVersion = "Windows NT 3.51" 
    ElseIf .dwMajorVersion = 4 Then 
    strVersion = "Windows NT 4.0" 
    ElseIf .dwMajorVersion = 5 Then 
    strVersion = "Windows 2000" 
    End If 
    
    strSP = Trim(.szCSDVersion) 
    End Select 
    
    strVersion = strVersion & vbCrLf & .dwMajorVersion & "." & .dwMinorVersion & "." & .dwBuildNumber 
    strVersion = strVersion & vbCrLf & strSP 
    End With 
    
    GetWindowsVersion = strVersion 
    End Function 
    
    
    Private Sub Form_Load() 
    MsgBox GetWindowsVersion 
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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