Announcement

Collapse
No announcement yet.

GetSystemDefaultLangID

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • GetSystemDefaultLangID

    I want to use this in my script.

    code:

    System::Call 'kernel32::GetSystemDefaultLangID(i v)i .R7'

    If I know the language, I can set some Variables with the right value.
    But my Output of R7 is in my case : 1508361
    I tried google but noway this is a LangID.
    How can I covert the value to a Valid LangID

    Glim

  • #2
    If you cast 1508361 to a LANGID (short), you get 1033, which is actually ${LANG_ENGLISH}. GetSystemDefaultLangID returns a short, not a 4 bytes integer. I don't understand why it'd return that extra byte of 17. When called from a C program, it returns the correct value, but the C program only takes 2 bytes off eax. I'll have to look into it...

    For now, you can "cast" $R7 yourself, using:
    code:
    IntOp $R7 $R7 & 0xFFFF
    NSIS FAQ | NSIS Home Page | Donate $
    "I hear and I forget. I see and I remember. I do and I understand." -- Confucius

    Comment


    • #3
      Fixed for 2.19.
      NSIS FAQ | NSIS Home Page | Donate $
      "I hear and I forget. I see and I remember. I do and I understand." -- Confucius

      Comment


      • #4
        Thanks Kichik

        Comment


        • #5
          Good fix, Thanks!
          "Just do it"

          Comment


          • #6
            I've had problems (until I found this thread) with GetSystemDefaultLangID on Vista. On XP it returns 1050 (Croatian, default on my system), but in Vista it returns a 7-digit code (just like in Glimmerman's case), which is different every time. Kichik's 'casting trick' fixes this and turns those values into 1050. Thanks Kichik!
            GetUserDefaultLangID, on the other hand, works perfectly fine, it returns a valid LangID in both XP and Vista.
            Problems aside, I'm wondering which function is generally preferred and 'safer' to use?
            PostEnd:

            Comment

            Working...
            X