Re: Word/Windows Language
- From: "Karl E. Peterson" <karl@xxxxxxxx>
- Date: Thu, 1 Feb 2007 09:52:43 -0800
jille <jille@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I need to be able to determine which version of Word/Windows they are using
(not the Dictionary language): English or French.
This oughta do it:
' Win32 Locale functions
Private Declare Function GetSystemDefaultLangID Lib "kernel32" () As Integer
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
' Localized name of language
Private Const SORT_DEFAULT As Long = &H0 ' sorting default
Private Const LOCALE_SLANGUAGE = &H2
Public Function LocaleLangauge(Optional LCID As Long) As String
Dim nRet As Long
Dim buf As String
' If user didn't provide an LCID, use
' current system default value.
If LCID = 0 Then
LCID = GetSystemDefaultLangID
End If
' Determine buffer requirement for language.
nRet = GetLocaleInfo(LCID, LOCALE_SLANGUAGE, buf, 0)
buf = Space$(nRet)
' Obtain language description.
Call GetLocaleInfo(LCID, LOCALE_SLANGUAGE, buf, Len(buf))
LocaleLangauge = TrimNull(buf)
End Function
Actually, you'd probably do best just querying for the LCID, and comparing it to
those you're willing/able to work with. See also:
List of Locale ID (LCID) Values as Assigned by Microsoft
http://www.microsoft.com/globaldev/reference/lcid-all.mspx
--
..NET: It's About Trust!
http://vfred.mvps.org
.
- Next by Date: Re: Multi-Thread execution from VBA
- Next by thread: Re: Multi-Thread execution from VBA
- Index(es):
Relevant Pages
|