Obtener la edición de Windows (Sólo para windows VISTA o superior)
Código (vbnet) [Seleccionar]
#Region " Get OS Edition Function "
' [ Get OS Edition Function ]
'
' Examples :
' Dim Edition As String = Get_OS_Edition()
' MsgBox("You are running Windows " & Get_OS_Edition() & " Edition")
Private Const STARTER As Integer = &HB
Private Const HOME_BASIC As Integer = &H2
Private Const HOME_BASIC_N As Integer = &H5
Private Const HOME_PREMIUM As Integer = &H3
Private Const HOME_PREMIUM_N As Integer = &H1A
Private Const BUSINESS As Integer = &H6
Private Const BUSINESS_N As Integer = &H10
Private Const ENTERPRISE As Integer = &H4
Private Const ENTERPRISE_N As Integer = &H1B
Private Const ULTIMATE As Integer = &H1
Private Const ULTIMATE_N As Integer = &H1C
Private Declare Function GetProductInfo Lib "kernel32" (ByVal dwOSMajorVersion As Integer, ByVal dwOSMinorVersion As Integer, ByVal dwSpMajorVersion As Integer, ByVal dwSpMinorVersion As Integer, ByRef pdwReturnedProductType As Integer) As Integer
Public Function Get_OS_Edition() As String
Dim Edition_Type As Integer
If GetProductInfo(Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor, 0, 0, Edition_Type) Then
Select Case Edition_Type
Case STARTER : Return "Starter"
Case HOME_BASIC : Return "Home Basic"
Case HOME_BASIC_N : Return "Home Basic N"
Case HOME_PREMIUM : Return "Home Premium"
Case HOME_PREMIUM_N : Return "Home Premium N"
Case BUSINESS : Return "Business"
Case BUSINESS_N : Return "Business N"
Case ENTERPRISE : Return "Enterprise"
Case ENTERPRISE_N : Return "Enterprise N"
Case ULTIMATE : Return "Ultimate"
Case ULTIMATE_N : Return "Ultimate N"
Case Else : Return "Unknown"
End Select
End If
Return Nothing ' Windows is not VISTA or Higher
End Function
#End Region