Opt("GUIOnEventMode", 1)
Local $sCtrlBtn[2][8] = [["测 试 一", "测 试 二", "测 试 三", "测 试 四", "测 试 五", '读取', '保存', '退出']]
Local $hMain = GUICreate("", 200, 200, -1, -1)
GUISetOnEvent(-3, "_Exit")
For $i = 0 To UBound($sCtrlBtn, 2) - 4
$sCtrlBtn[1][$i] = GUICtrlCreateCheckbox(StringFormat("%s\t%s\t%s",$sCtrlBtn[0][$i]), 10, 10 + $i * 25)
If IniRead("t.ini", "Setting", "Menu" & $i, "") == 1 Then GUICtrlSetState(-1, 1)
Next
Local $Label=GUICtrlCreateLabel("",100,20,200,100),$sLabel=False
GUICtrlSetFont(-1, 24)
GUICtrlSetColor(-1, 0x0860a8)
$sCtrlBtn[1][5] = GUICtrlCreateButton($sCtrlBtn[0][5], 5, 160, 60, 30)
$sCtrlBtn[1][6] = GUICtrlCreateButton($sCtrlBtn[0][6], 65, 160, 60, 30)
$sCtrlBtn[1][7] = GUICtrlCreateButton($sCtrlBtn[0][7], 125, 160, 60, 30)
GUISetState()
GUICtrlSetOnEvent($sCtrlBtn[1][7], "_Exit")
GUIRegisterMsg(273, "WM_COMMAND")
While 1
If $sLabel And GUICtrlRead($Label)="" Then GUICtrlSetData($Label,"已"&@CRLF&"修"&@CRLF&"改")
WEnd
Func _exit()
Exit
EndFunc ;==>_exit
Func WM_COMMAND($hWnd, $Msg, $wParma, $lParma)
Local $CtrlID = BitAND($wParma, 0x0000FFFF)
Switch $CtrlID
Case $sCtrlBtn[1][0] To $sCtrlBtn[1][4]
If ($sLabel =False And GUICtrlRead($Label)="") Then $sLabel=True
Case $sCtrlBtn[1][5]
For $i = 0 To 4
If BitAND(IniRead("t.ini", "Setting", "Menu" & $i, ''), 1) Then
GUICtrlSetState($sCtrlBtn[1][$i], 1)
Else
GUICtrlSetState($sCtrlBtn[1][$i], 4)
EndIf
Next
$sLabel=False
GUICtrlSetData($Label,"")
Case $sCtrlBtn[1][6]
For $i = 0 To 4
IniWrite("t.ini", "Setting", "Menu" & $i, BitAND(GUICtrlRead($sCtrlBtn[1][$i]), 1))
Next
MsgBox(262144, '提示', '已保存')
ShellExecute("t.ini")
EndSwitch
EndFunc ;==>WM_COMMAND