Click here to Skip to main content
15,867,686 members
Articles / Programming Languages / Visual Basic
Article

Operating System Information

Rate me:
Please Sign up or sign in to vote.
3.20/5 (10 votes)
22 Jun 2005 48K   866   27   2
An article on finding the OS name and OS language.

Sample Image

Introduction

This code finds OS information, i.e., it finds the name of the OS which is installed in your machine and the language of the OS.

Using the code

This code uses the WqlObjectQuery to find OS information. It uses the namespace System.Management. What is does is it basically finds the locale of the OS which is specific for a particular language of the OS. It actually queries the table win32_OperatingSystem which comes up with the operating system to find the OS name and the locale of the OS. This code runs on both 32 bit and 64 bit OS if there is .NET framework installed in the OS. For example, I make the code to find the locale of 8 different languages like English, German, French, Russian, Spanish, PortBraz, Polish and Italian. Any locale can be added to the code to find the OS Language.

VB
Dim objectQuery As New WqlObjectQuery("select * from win32_OperatingSystem")
Dim searcher As New ManagementObjectSearcher(objectQuery)
Dim share As ManagementObject
Dim a As String
Dim os As String
For Each share In searcher.Get()
    a = share("Name")
    Dim split1 As String()
    split1 = Split(a, "|")
    os = split1(0)
    TextBox2.Text = os
    Button2.Text = os
Next share

For Each share In searcher.Get()

    a = share("Locale")
    If a = "0409" Then
        TextBox1.Text = "English"
        Button1.Text = "English"
    ElseIf a = "0407" Then
        TextBox1.Text = "German"
        Button1.Text = "German"
    ElseIf a = "040a" Then
        TextBox1.Text = "Spanish"
        Button1.Text = "Spanish"
    ElseIf a = "040c" Then

Points of Interest

This code is useful for GUI translation. Using this code one can translate the GUI to any specific language.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
I am a Computer Engineer and in the Software
Industry for 1 year.Working on VC++,and Client Server architecture.

Comments and Discussions

 
Generalpushpa Pin
pushpaabhi11-Jun-08 22:25
pushpaabhi11-Jun-08 22:25 
QuestionDetect Licence Language version of OS? Pin
boshesh13-Jul-06 5:15
boshesh13-Jul-06 5:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.