How to check the current keyboard\'s language using vb6 ?
IF (\"Is it the English language\") Then
Msgbox \"EN\"
End IF
I believe its GetKeyboardLayoutName.
I'm using this not very tested snippet
Private Const LOCALE_SISO639LANGNAME As Long = &H59
Private Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) 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 Sub Command1_Click()
MsgBox pvGetUserLocaleInfo(GetKeyboardLayout(0&) And &HFFFF&, LOCALE_SISO639LANGNAME)
End Sub
Private Function pvGetUserLocaleInfo(ByVal dwLocaleID As Long, ByVal dwLCType As Long) As String
Dim sReturn As String
Dim nSize As Long
nSize = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn))
If nSize > 0 Then
sReturn = Space$(nSize)
nSize = GetLocaleInfo(dwLocaleID, dwLCType, sReturn, Len(sReturn))
If nSize > 0 Then
pvGetUserLocaleInfo = Left$(sReturn, nSize - 1)
End If
End If
End Function