how to know the windows language?!!

Just starting out? Need help? Post your questions and find answers here.
doodlemunch
Enthusiast
Enthusiast
Posts: 237
Joined: Tue Apr 05, 2005 11:20 pm

how to know the windows language?!!

Post 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 ?
doodlemunch
Enthusiast
Enthusiast
Posts: 237
Joined: Tue Apr 05, 2005 11:20 pm

Post 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
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Post 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
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Post 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
doodlemunch
Enthusiast
Enthusiast
Posts: 237
Joined: Tue Apr 05, 2005 11:20 pm

Post 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 ???
roachofdeath
User
User
Posts: 78
Joined: Sun Apr 24, 2005 3:22 am

Post by roachofdeath »

You could use the GetLocaleInfo API Call, and retrieve the language rather easily. (You DO mean speaking language, right?)
doodlemunch
Enthusiast
Enthusiast
Posts: 237
Joined: Tue Apr 05, 2005 11:20 pm

Post by doodlemunch »

i DO mean the windows language and NOT the speaking or keyboardd language
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post 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:
doodlemunch
Enthusiast
Enthusiast
Posts: 237
Joined: Tue Apr 05, 2005 11:20 pm

Post 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
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post by josku_x »

OK, I can find out something for you I try to search for a API command..
Dr. Dri
Enthusiast
Enthusiast
Posts: 243
Joined: Sat Aug 23, 2003 6:45 pm

Post by Dr. Dri »

josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post 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...
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post 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
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post 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
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

Works well in xp english (reporting english "united states") and works well in winme spanish (reporting español "españa").
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
Post Reply