Results 1 to 7 of 7

Thread: finding Windows Version

  1. #1

    Thread Starter
    Hyperactive Member scsa20's Avatar
    Join Date
    Apr 2001
    Location
    Mars
    Posts
    456

    finding Windows Version

    I know there's one at http://www.vbforums.com/showthread.p...hreadid=157607 but when I tryed adding in the ones for the Windows XP and 2000 and such, I just get debugging errors....can someone give me the full codeing of it (with the 2000 and XP in it too)?? thanks.


    p|-|34|2 /\/\3 f0|2 | $p34k 1337
    My TSS quote of the day: "If your haveing a bad day, just press the restart button."

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    How about right here, on this very same page...

    http://forums.vb-world.net/showthrea...hreadid=157607

  3. #3

    Thread Starter
    Hyperactive Member scsa20's Avatar
    Join Date
    Apr 2001
    Location
    Mars
    Posts
    456
    it seems like you didn't read all the way thru. I did put that code in, but when I tryed puting in:

    VB Code:
    1. .dwMajorVersion = 5 ' win2K or XP
    2. .dwMinorVersion = 0 ' Win 2000
    3. .dwMinroVersion = 1 ' Win XP

    or something like that, I just get a error, so I wantted to know what the full code with that part in it looks like. thanks


    p|-|34|2 /\/\3 f0|2 | $p34k 1337
    My TSS quote of the day: "If your haveing a bad day, just press the restart button."

  4. #4

    Thread Starter
    Hyperactive Member scsa20's Avatar
    Join Date
    Apr 2001
    Location
    Mars
    Posts
    456
    sorry for doing this but....^bump^


    p|-|34|2 /\/\3 f0|2 | $p34k 1337
    My TSS quote of the day: "If your haveing a bad day, just press the restart button."

  5. #5
    Shady009
    Guest
    You should read my thread, but anyway

    put this in a module

    VB Code:
    1. 'constants returned by OperatingSystem
    2. Global Const Windows95 As Integer = 95
    3. Global Const Windows98 As Integer = 98
    4. Global Const WindowsNT3 As Integer = 3 'v3.51
    5. Global Const WindowsNT4 As Integer = 4
    6. Global Const WindowsXP As Integer = 1

    Put this on your form

    VB Code:
    1. Private Type OSVersionInfo
    2.    dwOSVersionInfoSize As Long
    3.    dwMajorVersion As Long
    4.    dwMinorVersion As Long
    5.    dwBuildNumber As Long
    6.    dwPlatformID As Long
    7.    szCSDVersion As String * 128
    8. End Type
    9.  
    10. Private Declare Function GetVersionExA Lib "kernel32" (lpVersionInformation As OSVersionInfo) As Integer
    11.  
    12. Public Function OperatingSystem() As Integer
    13. Dim OSInfo As OSVersionInfo
    14. Dim RetValue As Integer
    15.  
    16. OSInfo.dwOSVersionInfoSize = 148
    17. OSInfo.szCSDVersion = Space$(128)
    18. RetValue = GetVersionExA(OSInfo)
    19.  
    20. With OSInfo
    21. Select Case .dwPlatformID
    22.    Case 1
    23.       If .dwMinorVersion = 0 Then
    24.          OperatingSystem = Windows95
    25.       ElseIf .dwMinorVersion = 10 Then
    26.          OperatingSystem = Windows98
    27.       End If
    28.    Case 2
    29.       If .dwMajorVersion = 3 Then
    30.          OperatingSystem = WindowsNT3
    31.       ElseIf .dwMajorVersion = 4 Then
    32.          OperatingSystem = WindowsNT4
    33.        ElseIf .dwMinorVersion = 1 Then
    34.          OperatingSystem = WindowsXP ' Win XP
    35.          ElseIf .dwMinorVersion = 0 Then
    36.          OperatingSystem = Windows2000 ' Win 2000
    37.          
    38.          End If
    39.      
    40.    Case Else
    41.       OperatingSystem = 0
    42. End Select
    43. End With
    44. End Function

    If you want an image to show, or a message box to pop up, do this :

    VB Code:
    1. Private Sub Form_Load()
    2. If OperatingSystem = WindowsXP Then 'what you want it to do. You can change WindowsXP to Windows98, Windows2000 and so on.
    3. End Sub

  6. #6

    Thread Starter
    Hyperactive Member scsa20's Avatar
    Join Date
    Apr 2001
    Location
    Mars
    Posts
    456
    I just get this error that you see in the picture below



    p|-|34|2 /\/\3 f0|2 | $p34k 1337
    My TSS quote of the day: "If your haveing a bad day, just press the restart button."

  7. #7

    Thread Starter
    Hyperactive Member scsa20's Avatar
    Join Date
    Apr 2001
    Location
    Mars
    Posts
    456
    never mind, I found something at http://www.planetsourcecode.com/vb/s...27682&lngWId=1 that helped me out


    p|-|34|2 /\/\3 f0|2 | $p34k 1337
    My TSS quote of the day: "If your haveing a bad day, just press the restart button."

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