The Glimmerman
5th August 2006 10:38 UTC
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
kichik
5th August 2006 11:36 UTC
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
kichik
5th August 2006 12:01 UTC
Fixed for 2.19.
The Glimmerman
6th August 2006 11:22 UTC
Thanks Kichik
onad
7th August 2006 12:38 UTC
Good fix, Thanks!
aerDNA
23rd October 2008 17:35 UTC
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?