Page 1 of 2
how to know the windows language?!!
Posted: Wed Nov 02, 2005 9:35 pm
by doodlemunch
hi i need a bulletproof method for knowing the language of the installed windows OS i already know the version thanks to pb functions but how to know the language? bullet prooof method anyone knows ?
Posted: Wed Nov 02, 2005 9:43 pm
by doodlemunch
i foundt a source
; English forum:
http://purebasic.myforums.net/viewtopic ... ight=greek
; Author: GPI
; Date: 03. March 2003
buuut my xp is english and my keyboard language is other howevr the source told me the KEYBOARD laongauge and not the OS !!!!!!!!!
see this is nott bullet proof
Posted: Wed Nov 02, 2005 10:18 pm
by Droopy
with vbs ?
Code: Select all
Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
Wscript.Echo "Boot Device: " & objOperatingSystem.BootDevice
Wscript.Echo "Build Number: " & objOperatingSystem.BuildNumber
Wscript.Echo "Build Type: " & objOperatingSystem.BuildType
Wscript.Echo "Caption: " & objOperatingSystem.Caption
Wscript.Echo "Code Set: " & objOperatingSystem.CodeSet
Wscript.Echo "Country Code: " & objOperatingSystem.CountryCode
Wscript.Echo "Debug: " & objOperatingSystem.Debug
Wscript.Echo "Encryption Level: " & objOperatingSystem.EncryptionLevel
dtmConvertedDate.Value = objOperatingSystem.InstallDate
dtmInstallDate = dtmConvertedDate.GetVarDate
Wscript.Echo "Install Date: " & dtmInstallDate
Wscript.Echo "Licensed Users: " & _
objOperatingSystem.NumberOfLicensedUsers
Wscript.Echo "Organization: " & objOperatingSystem.Organization
Wscript.Echo "OS Language: " & objOperatingSystem.OSLanguage
Wscript.Echo "OS Product Suite: " & objOperatingSystem.OSProductSuite
Wscript.Echo "OS Type: " & objOperatingSystem.OSType
Wscript.Echo "Primary: " & objOperatingSystem.Primary
Wscript.Echo "Registered User: " & objOperatingSystem.RegisteredUser
Wscript.Echo "Serial Number: " & objOperatingSystem.SerialNumber
Wscript.Echo "Version: " & objOperatingSystem.Version
Next
Posted: Wed Nov 02, 2005 10:26 pm
by Droopy
Or with DroopyLib and the WMI Function (Author : DataMiner )
Code: Select all
MessageRequester("WMI",WMI("Select * from Win32_OperatingSystem,OSLanguage"))
You have all code of OSLanguage here :
http://msdn.microsoft.com/library/defau ... system.asp
Posted: Wed Nov 02, 2005 11:51 pm
by doodlemunch
thanks! ill check it outt
does anione know how to use the PureZIP_W library??
ZLIBzipOpenNewFileInZip3(zipFile.l, *FileName, *zip_fileinfo, *extrafield_local, size_extrafield_local.l, *extrafield_global, size_extrafield_global.l, *comment, method.l, level.l, raw.l, windowBits.l, memLevel.l, strategy.l, *password, crcForCrypting.l)
i tried using ZLIBzipOpenNewFileInZip buuuut the zip is only saved with the file names pathts and all but no file data i mean they are 0 bytes files what is the probelm ???
Posted: Thu Nov 03, 2005 3:01 am
by roachofdeath
You could use the GetLocaleInfo API Call, and retrieve the language rather easily. (You DO mean speaking language, right?)
Posted: Thu Nov 03, 2005 4:17 am
by doodlemunch
i DO mean the windows language and NOT the speaking or keyboardd language
Posted: Sun Nov 06, 2005 10:19 am
by josku_x
He means, for example if a user has Windows XP Swedish, the program would output "swedish", right???
Well, I'm using finnish here, damn Finland :roll:
Posted: Sun Nov 06, 2005 7:47 pm
by doodlemunch
yepperz i just want to know that and not the lanjuage of the keybord because that wount help me at all you know the XP lanjuage i mean
Posted: Mon Nov 07, 2005 5:20 pm
by josku_x
OK, I can find out something for you I try to search for a API command..
Posted: Mon Nov 07, 2005 5:53 pm
by Dr. Dri
Posted: Mon Nov 07, 2005 7:07 pm
by josku_x
Sure you can use that, but you could also use this: (not tested, also no guarantee it works on PB as I'm at friend and he doesn't have PB

)
Code: Select all
UserLanguage=GetUserDefaultUILanguage_()
SystemLanguage=GetSystemDefaultUILanguage_()
MessageRequester("Info", "Your User Language is: "+UserLanguage, #MB_ICONINFORMATION)
MessageRequester("Info", "Your System Language is: "+SystemLanguage, #MB_ICONINFORMATION)
Please tell me if that code even works, I think it should work.,.,,
- Josku_X.
EDIT: I have now seen many Visual Basic snippets using this function and it seems, it returns an integer value, I'll update this code when I'm home. So I'll add language enumeration...
Posted: Tue Nov 08, 2005 5:49 am
by Sparkie
I whipped this one up and tested it on WinXP only with PB 3.94.
Code: Select all
;--> Get OS version language
;--> Author: Sparkie
;--> Date: 11/07/2005
Procedure.s GetOSLanguage()
result$ = "Error: Unable to determine OS Language"
If OpenLibrary(0, "version.dll")
sysDir$ = Space(#MAX_PATH + 1)
osLang$ = Space(100)
GetSystemDirectory_(@sysDir$, #MAX_PATH + 1)
fviSize = CallFunction(0, "GetFileVersionInfoSizeA", sysDir$ + "/User.exe", @zeroVar)
If fviSize > 0
*fviBuffer = AllocateMemory(fviSize)
If CallFunction(0, "GetFileVersionInfoA", sysDir$ + "/User.exe", 0, fviSize, *fviBuffer) <> 0
If CallFunction(0, "VerQueryValueA", *fviBuffer, "\\VarFileInfo\\Translation", @pBuffer, @valLen) <> 0
If CallFunction(0, "VerLanguageNameA", PeekW(pBuffer), @osLang$, 100) <> 0
result$ = osLang$
EndIf
EndIf
EndIf
FreeMemory(*fviBuffer)
EndIf
CloseLibrary(0)
Else
result$ = "Error: Unable to open version.dll"
EndIf
ProcedureReturn result$
EndProcedure
MessageRequester("OS Language", GetOSLanguage())
End
Posted: Tue Nov 08, 2005 2:02 pm
by dell_jockey
Sparkie wrote:I whipped this one up and tested it on WinXP only with PB 3.94.
Code: Select all
;--> Get OS version language
;--> Author: Sparkie
;--> Date: 11/07/2005
Procedure.s GetOSLanguage()
result$ = "Error: Unable to determine OS Language"
If OpenLibrary(0, "version.dll")
sysDir$ = Space(#MAX_PATH + 1)
osLang$ = Space(100)
GetSystemDirectory_(@sysDir$, #MAX_PATH + 1)
fviSize = CallFunction(0, "GetFileVersionInfoSizeA", sysDir$ + "/User.exe", @zeroVar)
If fviSize > 0
*fviBuffer = AllocateMemory(fviSize)
If CallFunction(0, "GetFileVersionInfoA", sysDir$ + "/User.exe", 0, fviSize, *fviBuffer) <> 0
If CallFunction(0, "VerQueryValueA", *fviBuffer, "\\VarFileInfo\\Translation", @pBuffer, @valLen) <> 0
If CallFunction(0, "VerLanguageNameA", PeekW(pBuffer), @osLang$, 100) <> 0
result$ = osLang$
EndIf
EndIf
EndIf
FreeMemory(*fviBuffer)
EndIf
CloseLibrary(0)
Else
result$ = "Error: Unable to open version.dll"
EndIf
ProcedureReturn result$
EndProcedure
MessageRequester("OS Language", GetOSLanguage())
End
On my XP-Pro box, this code reports the correct language(s)...
Thanks
Posted: Tue Nov 08, 2005 6:09 pm
by dagcrack
Works well in xp english (reporting english "united states") and works well in winme spanish (reporting español "españa").