CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Get OS Language

  1. #1
    Join Date
    May 2002
    Posts
    19

    Get OS Language

    Hi,
    I need to get the installed OS Language. I don't need the default Locale Language. I installed Windows 2000 English in my m/c.
    Later i changed the default Locale to Japanese.
    So when i check for the OS Language, i need to get the English as the answer.

    //I tried the follwing things. But these are giving only the default
    //Locale Language. I need the installed OS Language.

    LANGID lgid =GetSystemDefaultLangID();
    LCUD lcid2 = PRIMARYLANGID(lcid );
    LCID lcid = GetSystemDefaultLCID();

    How can i get the OS Language?.

    Thanks in Advance

  2. #2
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Have you looked at GetLocaleInfo(...)

    passing in:

    LOCALE_SYSTEM_DEFAULT (1st param)

    LOCALE_NOUSEROVERRIDE | LOCALE_IDEFAULTLANGUAGE (2nd param)

    etc...

  3. #3
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    if the previous post still returns the default locale you've set then you might also want to try...
    LOCALE_SNATIVELANGNAME | LOCALE_NOUSEROVERRIDE and see if that works...

  4. #4
    Join Date
    May 2002
    Posts
    19
    I tried GetLocaleInfo too. But it is also giving the default language set in the Regional Settings.

    Actually i need the OS installed language.

    GetLocaleInfo(LOCALE_SYSTEM_DEFAULT ,
    LOCALE_NOUSEROVERRIDE | LOCALE_IDEFAULTLANGUAGE ,szCData, 255 );

    Can anybody know it how can we get the OS installed language.

  5. #5
    Join Date
    May 2002
    Posts
    19
    I tried with
    LOCALE_SNATIVELANGNAME | LOCALE_NOUSEROVERRIDE.

    Still it shows the default regional settings option - Japanese.


    I think GetLocaleInfo will always give the default Regional Settings Option.

    Is there any other API to get the language of the installed Windows 2000.

    Thanks in Advance

  6. #6
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Hmm not really sure, but while your waiting for maybe another answer you can look here (or ask there)..

    http://www.microsoft.com/globaldev/DrIntl/default.mspx

    here's article 4 and a index that lists function calls etc:

    http://www.microsoft.com/globaldev/r...caletable.mspx


    You might want to try the call

    GetSystemDefaultUILanguage(...) since that is 'not' changable (or so the chart implies) and should the LANGID of english for your install.

  7. #7
    Join Date
    May 2002
    Posts
    19
    HI Mick,
    So far i couldn't get it.

    I tried to call GetSystemDefaultUILanguage() but it is giving compile time error. I included <Windows.h> and <Winnls.h>.
    But still it is giving error. I am lalso ooking into the other options u said before.

    Pls reply if u got any clue.

    Do i have to install Platform SDK.?

    Thanks & Regards
    Cherian

  8. #8
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Originally posted by cherian_2002
    HI Mick,
    So far i couldn't get it.

    I tried to call GetSystemDefaultUILanguage() but it is giving compile time error. I included <Windows.h> and <Winnls.h>.
    But still it is giving error. I am lalso ooking into the other options u said before.

    Pls reply if u got any clue.

    Do i have to install Platform SDK.?

    Thanks & Regards
    Cherian
    Yes it's in the SDK..

    You should get the SDK, because you'll be in the same boat when you try to use some other function down the line that's in the SDK

    Otherwise you can use LoadLibrary and GetProcAddress...but just get the SDK

    WINBASEAPI
    LANGID
    WINAPI
    GetSystemDefaultUILanguage(void);
    EDIT: guess I should say LoadLibrary instead of LoadLib cause Sam will complain

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured