#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <array.au3>
Dim $var[100], $ime[100], $imee = ""
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("输入法伪删除", 477, 50, 278, 127)
$Label1 = GUICtrlCreateLabel("选择输入法", 10, 25, 64, 20)
$Combo1 = GUICtrlCreateCombo("", 80, 20, 160, 25)
$button3 = GUICtrlCreateButton("删除", 380, 16, 50, 28, 0)
Readreg()
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $button3
Local $ime_temp
$delime = StringRegExp(GUICtrlRead($Combo1), '=(.+)', 3)
If UBound($delime) > 0 Then
For $i = 1 To $var[0]
If $var[$i] == $delime[0] Then
RegDelete('HKEY_CURRENT_USER\keyboard layout\preload', $i)
Else
$ime_temp &= $var[$i] & "|"
RegDelete('HKEY_CURRENT_USER\keyboard layout\preload', $i)
EndIf
Next
$arr = StringSplit(StringTrimRight($ime_temp, 1), "|")
For $n = 1 To $arr[0]
RegWrite('HKEY_CURRENT_USER\keyboard layout\preload', $n, 'REG_SZ', $arr[$n])
Next
EndIf
readreg()
MsgBox(0, 0, "重新启动后生效")
EndSwitch
WEnd
Func readreg()
GUICtrlSetData($Combo1, "")
$imee = ''
For $i = 1 To 100
$var[$i] = RegRead("HKEY_CURRENT_USER\keyboard layout\preload", $i)
If Not $var[$i] Then
$var[0] = $i - 1
ExitLoop
EndIf
Next
For $i = 1 To $var[0]
$ime[$i] = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Keyboard Layouts\" & $var[$i], "Layout Text")
If $ime[$i] Then $imee = $imee & $ime[$i] & "=" & $var[$i] & "|"
Next
If StringRight($imee, 1) = "|" Then $imee = StringTrimRight($imee, 1)
GUICtrlSetData($Combo1, $imee, $ime[1])
EndFunc ;==>readreg
|