Old 5th August 2006, 10:38   #1
The Glimmerman
Junior Member
 
Join Date: Jul 2006
Posts: 43
Smile 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
The Glimmerman is offline   Reply With Quote
Old 5th August 2006, 11:36   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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
kichik is offline   Reply With Quote
Old 5th August 2006, 12:01   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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
kichik is offline   Reply With Quote
Old 6th August 2006, 11:22   #4
The Glimmerman
Junior Member
 
Join Date: Jul 2006
Posts: 43
Thanks Kichik
The Glimmerman is offline   Reply With Quote
Old 7th August 2006, 12:38   #5
onad
Senior Member
 
onad's Avatar
 
Join Date: Dec 2004
Location: Turkey
Posts: 447
Good fix, Thanks!

"Just do it"
onad is offline   Reply With Quote
Old 23rd October 2008, 17:35   #6
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
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?
aerDNA is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump