Public Declare Function GetKeyboardLayoutName Lib "user32" Alias "GetKeyboardLayoutNameA" (pwszKLID As Any) As Long
Public Declare Function LoadKeyboardLayout Lib "user32" Alias "LoadKeyboardLayoutA" (ByVal HKL As String, ByVal Flags As Long) As Long
Dim bArr(500) As Byte
Function decodeString() As String
Dim i As Integer
Dim SS As String, bb As Byte
SS = ""
For i = 1 To 500
bb = bArr(i)
If bb <> 0 Then
SS = SS & Chr(bb)
Else
decodeString = SS
Exit Function
End If
Next i
decodeString = SS
Exit Function
End Function
Public Function getCurrentLanguage()
Dim z As Long
z = GetKeyboardLayoutName(bArr(1))
If z = 0 Then
getCurrentLanguage = ""
Else
getCurrentLanguage = decodeString
End If
End Function
Public Function getCurrentLanguage()
Dim z As Long
z = GetKeyboardLayoutName(bArr(1))
If z = 0 Then
getCurrentLanguage = ""
Else
getCurrentLanguage = decodeString
End If
End Function
'Переключает на русский
Public Function switchToRussian()
Dim SS As String
SS = getCurrentLanguage
If InStr(SS, "419") = 0 Then
LoadKeyboardLayout "00000419", 1
End If
End Function
'Переключает на английский
Public Function switchToEnglish()
Dim SS As String
SS = getCurrentLanguage
If InStr(SS, "409") = 0 Then
LoadKeyboardLayout "00000409", 1
End If
End Function
|