Public Declare Function GetKeyboardLayoutName Lib "user32" Alias "GetKeyboardLayoutNameA" (ByVal pwszklid As String) As Long
Public Declare Function LoadKeyboardLayout Lib "user32" Alias "LoadKeyboardLayoutA" (ByVal pwszklid As String, ByVal flags As Long) As Long
Public Sub changerlanguage(ByVal lg As Integer)
On Error Resume Next
Dim resultat As Long
Dim resultato As String
resultato = Space(10)
resultat = GetKeyboardLayoutName(resultato)
If lg = 1 Then
If LCase(Left(resultato, 8)) = "00000409" Or LCase(Left(resultato, 8)) = "00020401" Or LCase(Left(resultato, 8)) = "0000040c" Then
resultat = LoadKeyboardLayout("00020401", 1)
Else
resultat = LoadKeyboardLayout("00001c01", 1)
End If
Else
resultat = LoadKeyboardLayout("0000040c", 1)
End If
If resultat = 0 Then
MsgBox "vérifiez la version de windows", vbInformation, "Language de windows"
End If
End Sub