Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] Get Operating System. To Two Letter String (W7/VS/XP)
#1
Code:
' Generate Operating System
    Public Shared Function GenerateOperatingSystem() As String
  Dim os As System.OperatingSystem = System.Environment.OSVersion : Dim osName As String = "UN" : Select Case os.Platform
    Case System.PlatformID.Win32Windows : Select Case os.Version.Minor
    Case 0 : osName = "95" : Exit Select : Case 10 : osName = "98" : Exit Select : Case 90 : osName = "ME" : Exit Select : End Select : Exit Select
    Case System.PlatformID.Win32NT : Select Case os.Version.Major
    Case 3 : osName = "NT" : Exit Select : Case 4 : osName = "NT" : Exit Select
    Case 5 : If os.Version.Minor = 0 Then : osName = "2K" : ElseIf os.Version.Minor = 1 Then : osName = "XP" : ElseIf os.Version.Minor = 2 Then : osName = "2K3" : End If : Exit Select
    Case 6 : osName = "VS" : If os.Version.Minor = 0 Then : osName = "VS" : ElseIf os.Version.Minor = 1 Then : osName = "W7" : End If : Exit Select : End Select : Exit Select : End Select : Return osName
    End Function

Another Usefull snippet I made up.
Reply
#2
Or you can simply do this:

Code:
If My.Computer.Info.OSFullName.Contains("7") Then
            Label4.Text = "Application Disabled"
        ElseIf My.Computer.Info.OSFullName.Contains("Vista") Then
            Label4.Text = "Application Disabled"
        End If
[Image: t5BWm.png]
Reply
#3
I saw the exact script on HF a while ago :/ Anyway great share never the less
[Image: gviF7.gif]
"We've all heard that a million monkeys banging on a million typewriters
will eventually reproduce the entire works of Shakespeare.
Now, thanks to the Internet, we know this is not true." - Robert Wilensky
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Encrypt String using x509Certificate private Key wih RSA jeffstan 0 2,326 01-26-2014, 04:18 PM
Last Post: jeffstan
  [VB.NET] Determine If 32 Or 64 Bit Operating System. wchar_t 14 19,108 07-13-2013, 07:17 PM
Last Post: Varosion
  How To make an advanced Operating System in Visual Basic 2010 ? Mohamed Samir 9 11,565 01-15-2013, 09:30 PM
Last Post: Resistance
  Combination Cracker - String Variant Builder - Developed by AceInfinity AceInfinity 0 1,255 03-15-2012, 06:05 PM
Last Post: AceInfinity
  Detect When New Media/Storage Device Insertted - Get It's Drive Letter AceInfinity 0 591 03-08-2012, 09:15 PM
Last Post: AceInfinity

Forum Jump:


Users browsing this thread: 1 Guest(s)