How to find windows OS language
Blitz3D Forums/Blitz3D Programming/How to find windows OS language
| ||
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 :( |
| ||
There are some Windows API calls for obtaining the info: GetSystemDefaultUILanguage() GetUserDefaultUILanguage() GetLocaleInfo() |
| ||
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? |
| ||
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? |
| ||
It returns a Language Identifier (LANGID), which itself contains a primary and sublanguage identifiers. More here. |
| ||
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. |
| ||
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. |
| ||
Sorry, got a bit distracted and didn't have Blitz3D installed to test anything! :) Glad you got it sorted. |