Dans le but de créer un live CD XP pour le dépannage, j'ai créer une petite appli pour modifier la config clavier.
Le problème est que la modification n'est pas prise en compte immédiatement.
J'imagine que c'est une histoire de rundll32 ou un truc similaire
Quelqu'un a une idée ?
Merci beaucoup de votre aide
► Afficher le texte
Code : Tout sélectionner
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;;;;;;;;;;;;;;;;;;;; GUICREATE ;;;;;;;;;;;;;;;;;;;;
$titre = "KeyBord config"
$width = 240
$height = 180
;;;;;;;;;;;;;;;;;;;; VARIABLE ;;;;;;;;;;;;;;;;;;;;
$reg_Keyboard = RegRead("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1")
;MsgBox(64,$titre,$reg_Keyboard)
If $reg_Keyboard = "00000405" Then
$Keyboard = "Czech"
ElseIf $reg_Keyboard = "00000406" Then
$Keyboard = "Danish"
ElseIf $reg_Keyboard = "00000413" Then
$Keyboard = "Dutch (Standard)"
ElseIf $reg_Keyboard = "00000409" Then
$Keyboard = "English (United States)"
ElseIf $reg_Keyboard = "00000809" Then
$Keyboard = "English (United Kingdom)"
ElseIf $reg_Keyboard = "0000040B" Then
$Keyboard = "Finnish"
ElseIf $reg_Keyboard = "0000040C" Then
$Keyboard = "French (Standard)"
ElseIf $reg_Keyboard = "0000080C" Then
$Keyboard = "French (Belgian)"
ElseIf $reg_Keyboard = "0000100C" Then
$Keyboard = "French (Swiss)"
ElseIf $reg_Keyboard = "00000C0C" Then
$Keyboard = "French (Canadian)"
ElseIf $reg_Keyboard = "00000407" Then
$Keyboard = "German (Standard)"
ElseIf $reg_Keyboard = "00000807" Then
$Keyboard = "German (Swiss)"
ElseIf $reg_Keyboard = "0000040E" Then
$Keyboard = "Hungarian"
ElseIf $reg_Keyboard = "0000040F" Then
$Keyboard = "Icelandic"
ElseIf $reg_Keyboard = "00000410" Then
$Keyboard = "Italian (Standard)"
ElseIf $reg_Keyboard = "00000414" Then
$Keyboard = "Norwegian (Bokmal)"
ElseIf $reg_Keyboard = "00000415" Then
$Keyboard = "Polish"
ElseIf $reg_Keyboard = "00000816" Then
$Keyboard = "Portuguese (Portugal)"
ElseIf $reg_Keyboard = "00000416" Then
$Keyboard = "Portuguese (Brazil)"
ElseIf $reg_Keyboard = "00000419" Then
$Keyboard = "Russian"
ElseIf $reg_Keyboard = "0000041B" Then
$Keyboard = "Slovak"
ElseIf $reg_Keyboard = "00000424" Then
$Keyboard = "Slovenian"
ElseIf $reg_Keyboard = "0000080A" Then
$Keyboard = "Spanish (Mexican)"
ElseIf $reg_Keyboard = "0000040A" Then
$Keyboard = "Spanish (Traditional Sort)"
ElseIf $reg_Keyboard = "0000041D" Then
$Keyboard = "Swedish"
Else
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "0000040C")
$Keyboard = "French (Standard)"
EndIf
GUICreate($titre, $width, $height, -1, -1) ; will create a dialog box that when displayed is centered
;;; Parametres du clavier
GUICtrlCreateGroup("Customize keyboard", 10, 5, $width - 20, 57)
$var_keyboard = GUICtrlCreateCombo("", 20, 25, $width - 40, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "Czech|Danish|Dutch (Standard)|English (United States)|English (United Kingdom)|Finnish|French (Standard)|French (Belgian)|French (Swiss)|French (Canadian)|German (Standard)|German (Swiss)|Hungarian|Icelandic|Italian (Standard)|Norwegian (Bokmal)|Polish|Portuguese (Portugal)|Portuguese (Brazil)|Russian|Slovak|Slovenian|Spanish (Mexican)|Spanish (Traditional Sort)|Swedish", $Keyboard)
GUICtrlSetCursor(-1, 0)
;;; Ecrire ici
GUICtrlCreateGroup("Write here", 10, 65, $width - 20, 65)
GUICtrlCreateEdit("", 20, 80, $width - 40, 40, $ES_WANTRETURN)
;;; Vallider
$button = GUICtrlCreateButton("Validate", 10, $height - 40, $width - 20, 30)
GUICtrlSetCursor(-1, 0)
GUICtrlSetFont(-1, 12)
GUISetState(@SW_SHOW) ; will display an empty dialog box
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Select
Case $msg = $button
If GUICtrlRead($var_keyboard) = "Czech" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000405")
ElseIf GUICtrlRead($var_keyboard) = "Danish" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000406")
ElseIf GUICtrlRead($var_keyboard) = "Dutch (Standard)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000413")
ElseIf GUICtrlRead($var_keyboard) = "English (United States)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000409")
ElseIf GUICtrlRead($var_keyboard) = "English (United Kingdom)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000809")
ElseIf GUICtrlRead($var_keyboard) = "Finnish" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "0000040B")
ElseIf GUICtrlRead($var_keyboard) = "French (Standard)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "0000040C")
ElseIf GUICtrlRead($var_keyboard) = "French (Belgian)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "0000080C")
ElseIf GUICtrlRead($var_keyboard) = "French (Swiss)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "0000100C")
ElseIf GUICtrlRead($var_keyboard) = "French (Canadian)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000C0C")
ElseIf GUICtrlRead($var_keyboard) = "German (Standard)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000407")
ElseIf GUICtrlRead($var_keyboard) = "German (Swiss)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000807")
ElseIf GUICtrlRead($var_keyboard) = "Hungarian" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "0000040E")
ElseIf GUICtrlRead($var_keyboard) = "Icelandic" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "0000040F")
ElseIf GUICtrlRead($var_keyboard) = "Italian (Standard)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000410")
ElseIf GUICtrlRead($var_keyboard) = "Norwegian (Bokmal)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000414")
ElseIf GUICtrlRead($var_keyboard) = "Polish" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000415")
ElseIf GUICtrlRead($var_keyboard) = "Portuguese (Portugal)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000816")
ElseIf GUICtrlRead($var_keyboard) = "Portuguese (Brazil)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000416")
ElseIf GUICtrlRead($var_keyboard) = "Russian" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000419")
ElseIf GUICtrlRead($var_keyboard) = "Slovak" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "0000041B")
ElseIf GUICtrlRead($var_keyboard) = "Slovenian" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "00000424")
ElseIf GUICtrlRead($var_keyboard) = "Spanish (Mexican)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "0000080A")
ElseIf GUICtrlRead($var_keyboard) = "Spanish (Traditional Sort)" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "0000040A")
ElseIf GUICtrlRead($var_keyboard) = "Swedish" Then
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "0000041D")
Else
;;; sinon français
RegWrite("HKEY_CURRENT_USER\Keyboard Layout\Preload", "1", "REG_SZ", "0000040C")
EndIf
MsgBox(64, $titre, "Keyboard settings have been changed")
EndSelect
WEnd

