Thread: Windows Version

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    52
    Rep Power
    12

    Windows Version


    I'm looking for a piece of code that gets the current Windows version and puts it into a string. I have VB 6.0, any help would be greatly appreciated.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    138
    Rep Power
    12
    All depends on how many possibilites you want to cover

    you can use "GetVersionEx" or the just the "GetVersion"

    Public Declare Function GetVersionEx Lib "kernel32" _
    Alias "GetVersionExA" _
    (lpVersionInformation As OSVERSIONINFO) As Boolean

    Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
    End Type

    But that won't tell you if you are running server or workstation versions of NT.

    You can also use the registry key "HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions"
    If you know you are running windows NT.
    This gives you Operating System, Major Version, Minor Version
    Not sure what Win 2000 does, hopefully just has higher major and minor numbers. Let us know how you go.

    Heres a good link Where Am I Running?
    --

    ngibsonau
  4. #3
  5. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,640
    Rep Power
    4247
    >> But that won't tell you if you are running server or workstation versions of NT.
    Actually, you can tell what it is by examining the other members of the OSVersionInfo structure type. The following example is in C, but you can see what the code is doing to get whether it is a workstation or a server.
    http://msdn.microsoft.com/library/de...em_version.asp

IMN logo majestic logo threadwatch logo seochat tools logo