|
-
Oct 6th, 2007, 06:57 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] OS Language
How can I detect the OS language of Windows using VB6 ?
Thanks
-
Oct 6th, 2007, 08:04 PM
#2
Re: OS Language
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.
-
Oct 7th, 2007, 05:21 AM
#3
Thread Starter
Hyperactive Member
Re: OS Language
virtual rudeness is not a problem, just give an answer the next time.
-
Oct 7th, 2007, 05:52 AM
#4
Frenzied Member
Re: OS Language
What is OS Language?
The Laguage as English, French, Japanese, etc ...
Or the Laguage as Progrmaming Laguage?
-
Oct 7th, 2007, 06:57 AM
#5
PowerPoster
Re: OS Language
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
Last edited by rory; Oct 7th, 2007 at 07:31 AM.
-
Oct 7th, 2007, 05:57 PM
#6
Thread Starter
Hyperactive Member
Re: OS Language
Thanks Rory you understood the question right away!
-
Oct 7th, 2007, 06:16 PM
#7
PowerPoster
Re: OS Language
 Originally Posted by horazio
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. 
So if you need the OS version also, let me know.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|