How to find windows OS language

Blitz3D Forums/Blitz3D Programming/How to find windows OS language

Hujiklo(Posted 2010) [#1]
Is there a way in Blitz3D that I can find out if the user's windows installation is using a specific language ?

I have to lock out certain territories in my game, but do not know how to do it :(


xlsior(Posted 2010) [#2]
There are some Windows API calls for obtaining the info:

GetSystemDefaultUILanguage()
GetUserDefaultUILanguage()
GetLocaleInfo()


Hujiklo(Posted 2010) [#3]
Thanks Xlsior but which DLL or decls do I need so I can call them? I have the user32.dll but the decls file in the userlib directory does not have these calls declared.

Is user32.dll even the right dll for these calls?


Hujiklo(Posted 2010) [#4]
Okay - I got this to compile at least by using this call:

GetSystemDefaultUILanguage()

and making a decls for the kernel32.dll

However - what does it return?

Here it seems to suggest nothing:

http://msdn.microsoft.com/en-us/library/dd318123(VS.85).aspx

I tried using temp$ = GetSystemDefaultUILanguage()
, or Temp%=GetSystemDefaultUILanguage()
etc.. I tried all variable types but it says 'Illegal conversion"

What am I missing? Anyone?


GfK(Posted 2010) [#5]
It returns a Language Identifier (LANGID), which itself contains a primary and sublanguage identifiers.

More here.


Hujiklo(Posted 2010) [#6]
GfK thanks - I read up on that stuff, but I am confused about how do get that info into a variable I can check in Blitz3D. Everything I do gets me an error. Can anyone make a single line of code that would get me that info?

I have tried all variable types but no luck :(

...seems so simple in theory at least.


Hujiklo(Posted 2010) [#7]
Oh yes - I got it now:

http://support.microsoft.com/kb/221435

That link has a list that makes sense of the number returned buy the kernel32.dll

Quick test here:

Global l_id$ =api_GetUserDefaultLangID% ()
DebugLog "UID: "+ l_id$

This gives a number '2057' which is UK English according to the MS link above - great!!

Kernel32 decls are in the userlibs section of the code archives for anybody interested.

http://www.blitzbasic.com/codearcs/codearcs.php?code=1180

Thank you for your help - and thank you Boiled Sweets for the userlib.


GfK(Posted 2010) [#8]
Sorry, got a bit distracted and didn't have Blitz3D installed to test anything! :)

Glad you got it sorted.