Retrieve System Language

BlitzMax Forums/BlitzMax Programming/Retrieve System Language

I have been trying to get the current system language the blitzmax program is being executed on. i want to make a decision upon which language the game should show.
i have tried several things but it doesn't work out.
this is what i have tried:

Import "-luser32"

Extern "win32"

  Function GetSystemDefaultLangID () = "GetSystemDefaultLangID@0"
  Function VerLanguageName:Int (wLang:Int, szLang$z, nSize:Int ) = "VerLanguageNameA"
   
EndExtern

Local Lid:Int = GetSystemDefaultLangID()
Global Language:String
Notify "id = " + Lid
VerLanguageName( Lid, Language, 64 )
Notify "lang = " + Language

End


but this always gives me:
undefined reference to `VerLanguageNameA'


commenting this out will give me an ID.
but i could not find a table with matching values to it yet.
'VerLanguageName( Lid, Language, 64 )


maybe i am doing it completely wrong and there is a much better way to find out. could someone help, please?

Hm... Nobody has an idea?

Wouldn't it be VerLanguageNameA@4 as it returns int?

I thought it was the data which it takes, not returns. Which would make it VerLanguageNameA@12

http://www.microsoft.com/globaldev/reference/win2k/setup/lcid.mspx

This has a table with the IDs that you get from GetSystemDefaultLangID

I managed to get this to work:

Extern "Win32"
	Function GetSystemDefaultLangID:Int()
	Function VerLanguageNameA:Int(LangID:Int,Name:Byte Ptr,MaxSize:Int)
End Extern

Local ID:Int = GetSystemDefaultLangID()

Local TmpString:Byte Ptr = MemAlloc(30)

Print VerLanguageNameA(ID,TmpString,30)

Local LangName:String = ""

For Local Count:Int = 0 To 29
	LangName = LangName+Chr(TmpString[Count])
Next

Print LangName	
	
MemFree(TmpString)


There might be a better way but I'm not good at coming up with the best way to do things :)

I'm not sure what the max size of the memory needs to be but 30 was larger than what VerLanguageName was returning.

Hey, thank you guys.
Especially MattVonFat!

That was what i was looking for!
You really made my day :)

One crazy thing:
If i compile the exe in Debugmode: ID = 1031 (German)
if i compile the exe without Debug: ID = 15991815 (?)

Nonetheless "LangName" will show the correct Language.

what is this?

I tried it on mine with debug on and off but i still got the the same language code.

I found out what it was.

If you add:

AppTitle = "BuBu" ' Or whatever


before calling:

GetSystemDefaultLangID( ) 


you get those weird results.