dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Intermediate
Mar 18, 2000

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


WindowsVersionSP - Determine Windows version and NT service pack info

Private Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
End Type
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
    (lpVersionInformation As OSVERSIONINFO) As Long

' Returns Version of Windows as a String
' NOTE: Win95 returns "4.00", WIn98 returns "4.10"
'
' It also optionally returns the Windows NT Service Pack
' version in the argument, if one is passed

Function WindowsVersionSP(Optional NTServicePack As Integer) As String
    Dim osInfo As OSVERSIONINFO
    osInfo.dwOSVersionInfoSize = Len(osInfo)
    GetVersionEx osInfo
    WindowsVersionSP = osInfo.dwMajorVersion & "." & Right$( "0" & Format$ _
        (osInfo.dwMinorVersion), 2)
  
    If osInfo.dwMajorVersion = 4 Then
        If InStr(osInfo.szCSDVersion, "3") > 0 Then
            NTServicePack = 3
        ElseIf InStr(osInfo.szCSDVersion, "4") > 0 Then
            NTServicePack = 4
        ElseIf InStr(osInfo.szCSDVersion, "5") > 0 Then
            NTServicePack = 5
        ElseIf InStr(osInfo.szCSDVersion, "6") > 0 Then
            NTServicePack = 6
        Else
            NTServicePack = 0
        End If
    End If
End Function

Colin McNulty
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date