howto get Windows system language from registry

Posted on 2007-07-31
Last Modified: 2013-12-03
Hi all,

I'm doing some development on office automatisation, and i ran into a little problem i can easily avoid, if only I can get the language of the Windows OS installed...  The windows OS's i use are Windows 2003 and Windows XP. Now i'm running them in Dutch, French and English.
I guess there must be a registry-key somewhere indicating the installed Windows language...
Can anyone help me on that?

Thanx in advance!
Question by:jeroenlemaire
    LVL 11

    Accepted Solution


    you should use GetSystemDefaultLangID() this function returns a language ID and the list of return values can be found here:
    LVL 3

    Author Comment

    can this function be called from VBA? if yes, can u tell me how?
    LVL 11

    Expert Comment

    you can call this function using VBA. take a look at
    there is an article showing how to call this functon using vb
    LVL 3

    Author Comment

    For those who might be interested in how to use this in VBA:

    'declare the function to call from the kernel32
    Private Declare Function GetSystemDefaultLangID Lib "kernel32" () As Long

    Once you've done that, you can get the languageID in a string like this:
    Dim LanguageID as Integer
    LanguageID = CInt(CStr(Val("&H" & Right(Hex(GetSystemDefaultLangID()), 3))))

    Thanks for getting me started Jase-coder!
    The 250pts are for you!
    LVL 23

    Expert Comment

    This key here
    HKEY_USERS\.DEFAULT\Keyboard Layout\Preload
    sets the default language for the login screen, which may answer your query

    This link here shows the different country codes in use.

    hth, Danny
    LVL 3

    Author Comment

    this is not the system language, but the keyboard lay-out...
    i guess your kinda off-topic here...

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Just about everyone has an old PC laying around.  Ask anyone in the IT industry, whether they are a professional or play in it as a hobby.  From outdated Desktops to cheap "throwaway" laptops, they are all around and not as hard to "fix up" as you m…
    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now