Thank you bpoff, this works, but I need the name of the keyboard layout. All I get here is the number.
Main Topics
Browse All TopicsI have a Crypt-E-Mail application in developement in which the program can be used with 15 languages including Asian and Arabic.
I can query the OS and find out the number of keyboards that are installed and display them in a list. I would like to be able to have the user choose and change the keyboard from within the application without resorting to the Regional Options of XP.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
This code enumerates the Keyboard layouts in a class and returns the LCID for each layout. With this LCID you can then get the English name of language or localized name of language using KL.pfGLI(LCID, LOCALE_SLANGUAGE).
'Form code (AutoRedraw=True)
Option Explicit
Const LOCALE_SENGCOUNTRY As Long = &H1002 '// English name of country
Const LOCALE_SLANGUAGE As Long = &H2 '// localized name of language
Const LOCALE_SENGLANGUAGE As Long = &H1001 '// English name of language
Dim WithEvents KL As clsKeyboardLayout
Private Sub Form_Load()
Set KL = New clsKeyboardLayout
Print "LCID - LOCALE_SLANGUAGE"
Print "-----------------------"
KL.EnumKybdLayouts &H409
End Sub
Private Sub KL_EnumKybdLayouts(ByVal LCID As Long)
Print Hex(LCID) & " - " & KL.pfGLI(LCID, LOCALE_SLANGUAGE)
End Sub
'Class code
Option Explicit
Public Event EnumKybdLayouts(ByVal LCID As Long)
Private Declare Function GetKeyboardLayout& Lib "user32" (ByVal dwLayout As Long)
Private Declare Function GetKeyboardLayoutList& Lib "user32" (ByVal nBuff As Long, lpList As Long)
Private Declare Function ActivateKeyboardLayout& Lib "user32" (ByVal hkl As Long, ByVal flags As Long)
Private Declare Function GetKeyboardLayoutName Lib "user32" Alias "GetKeyboardLayoutNameA" (ByVal pwszKLID As String) As Long
Private Declare Function GetLocaleInfoA Lib "KERNEL32" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Const KL_NAMELENGTH As Long = 9
Const LOCALE_SENGCOUNTRY As Long = &H1002 '// English name of country
Const LOCALE_SLANGUAGE As Long = &H2 '// localized name of language
Private buf As String * KL_NAMELENGTH
Public Sub EnumKybdLayouts( _
Optional ByVal NewLayoutLCID As Long = 0, _
Optional ByVal bEnableCallback As Long = True)
Dim lOriginalLayout As Long
Dim lRet As Long
Dim i As Integer
ReDim lLayouts(50) As Long
Dim LCID As Long
'Save current configuration
lOriginalLayout = GetKeyboardLayout(0)
'Get the first 50 supported keyboard layouts (50 is max supported for now)
lRet = GetKeyboardLayoutList(50, lLayouts(0))
'Loop through all the keyboard layouts
For i = 0 To UBound(lLayouts)
If lLayouts(i) = 0 Then
Exit For
End If
'Activate the keyboard layout and get its name
lRet = ActivateKeyboardLayout(lLa
lRet = GetKeyboardLayout(0&)
LCID = LoWord(lRet)
If NewLayoutLCID = LCID Then
lOriginalLayout = lRet
End If
If bEnableCallback Then
RaiseEvent EnumKybdLayouts(LCID)
End If
Next i
'Restore current (or requested if available) configuration
lRet = ActivateKeyboardLayout(lOr
End Sub
Public Function pfGLI(ByVal m_LocaleLCID As Long, ByVal reqInfo As Long) As String
Dim Buffer As String * 255
GetLocaleInfoA m_LocaleLCID, reqInfo, Buffer, 255
pfGLI = StripNull(Buffer)
End Function
Private Function LoWord(wParam As Long) As Integer
If wParam And &H8000& Then
LoWord = &H8000& Or (wParam And &H7FFF&)
Else
LoWord = wParam And &HFFFF&
End If
End Function
Private Function StripNull(ByVal StrIn As String) As String
Dim nul As Long
nul = InStr(StrIn, vbNullChar)
Select Case nul
Case Is > 1
StripNull = Left$(StrIn, nul - 1)
Case 1
StripNull = ""
Case 0
StripNull = Trim$(StrIn)
End Select
End Function
Business Accounts
Answer for Membership
by: ComputronPosted on 2005-07-27 at 07:48:16ID: 14537302
Try this
e.com/Prog ramming/ Pr ogramming_ Languages/ Visual_Bas ic/Q_20387 081.html
http://www.experts-exchang