How can I detect the OS language of Windows using VB6 ?
Thanks
Printable View
How can I detect the OS language of Windows using VB6 ?
Thanks
How can you detect the operating system language of Windows using VB6....
Let's put this in medical terms.
How can you detect the source of cancer using a spatula.
While yes, I am being rude; I only hope the analogy gives you some perception about how wide your question is.
virtual rudeness is not a problem, just give an answer the next time.
What is OS Language?
The Laguage as English, French, Japanese, etc ...
Or the Laguage as Progrmaming Laguage?
:confused:
Code:Option Explicit
Private Declare Function GetUserDefaultLCID Lib "kernel32" () As Long
Private Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" _
(ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Private Const LOCALE_SCOUNTRY = &H6
Private Const LOCALE_SLANGUAGE = &H2
Private Const LOCALE_SENGLANGUAGE = &H1001
Private Const MAX_BUF As Long = 260
'get country name
Private Function GetCountryName() As String
Dim lID As Long, sBuf As String, lRet As Long
lID = GetUserDefaultLCID
sBuf = String$(MAX_BUF, Chr(0))
lRet = GetLocaleInfo(lID, LOCALE_SCOUNTRY, sBuf, MAX_BUF)
GetCountryName = Left$(sBuf, lRet - 1)
End Function
'get localized language
Private Function GetLocaleLanguage() As String
Dim lID As Long, sBuf As String, lRet As Long
lID = GetUserDefaultLCID
sBuf = String$(MAX_BUF, Chr(0))
lRet = GetLocaleInfo(lID, LOCALE_SLANGUAGE, sBuf, MAX_BUF)
GetLocaleLanguage = Left$(sBuf, lRet - 1)
End Function
'get language (in english)
Private Function GetLocaleEngLanguage() As String
Dim lID As Long, sBuf As String, lRet As Long
lID = GetUserDefaultLCID
sBuf = String$(MAX_BUF, Chr(0))
lRet = GetLocaleInfo(lID, LOCALE_SENGLANGUAGE, sBuf, MAX_BUF)
GetLocaleEngLanguage = Left$(sBuf, lRet - 1)
End Function
Private Sub Form_Load()
Debug.Print "Country Name is: " & GetCountryName
Debug.Print "Language (Localized): " & GetLocaleLanguage
Debug.Print "Language (in English): " & GetLocaleEngLanguage
End Sub
Thanks Rory you understood the question right away!
No problem, actually I put together code to get the OS Version at first (was a late night), then came back and noticed it was the Language you really wanted. :DQuote:
Originally Posted by horazio
So if you need the OS version also, let me know. ;)