Click here to Skip to main content
11,483,586 members (69,789 online)
Click here to Skip to main content

Operating System Information

, 22 Jun 2005 39.1K 644 27
Rate this:
Please Sign up or sign in to vote.
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.

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

Share

About the Author

cs_debraj@rediffmail.com
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 23:25
memberpushpaabhi11-Jun-08 23:25 
QuestionDetect Licence Language version of OS? Pin
boshesh13-Jul-06 6:15
memberboshesh13-Jul-06 6:15 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150520.1 | Last Updated 23 Jun 2005
Article Copyright 2005 by cs_debraj@rediffmail.com
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid