#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("开启GUI窗口,自动读InI,关闭窗口自动存档到INI", 623, 442, 192, 124)
$Input1 = GUICtrlCreateInput("", 64, 56, 193, 21)
$Input2 = GUICtrlCreateInput("", 64, 128, 193, 21)
$Button1 = GUICtrlCreateButton("交换", 320, 88, 97, 33)
$Label1 = GUICtrlCreateLabel("关键字1的值", 64, 30, 200, 17)
$Label2 = GUICtrlCreateLabel("关键字2的值", 64, 100, 200, 17)
GUICtrlSetData($Input1, IniRead(@ScriptDir & "\test.ini", "字段名", "关键字1", "关键字1读取失败"))
GUICtrlSetData($Input2, IniRead(@ScriptDir & "\test.ini", "字段名", "关键字2", "关键字2读取失败"))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
IniWrite(@ScriptDir & "\test.ini", "字段名", "关键字1", GUICtrlRead($Input1))
IniWrite(@ScriptDir & "\test.ini", "字段名", "关键字2", GUICtrlRead($Input2))
Exit
Case $Button1
$tmp = GUICtrlRead($Input1)
GUICtrlSetData($Input1,GUICtrlRead($Input2))
GUICtrlSetData($Input2,$tmp)
EndSwitch
WEnd
配置文件
[字段名]
关键字1=谷歌
关键字2=百度
|