Archive: GetSystemDefaultLangID


GetSystemDefaultLangID
I want to use this in my script.


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

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:

IntOp $R7 $R7 & 0xFFFF

Fixed for 2.19.


Thanks Kichik


Good fix, Thanks!


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?