#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;~ Opt("GUIOnEventMode", 1);gui使用onevent模式
#Region ### START Koda GUI section ### Form=
;~ $exename=IniRead("config.ini","path","exename","")
$Form1 = GUICreate("Form1", 260, 80)
$Input1 = GUICtrlCreateInput("", 10, 10, 250, 25)
$Button1 = GUICtrlCreateButton("选择文件", 10, 40, 70, 25)
$Button2 = GUICtrlCreateButton("写入INI", 90, 40, 70, 25)
$Button3 = GUICtrlCreateButton("读取INI", 170, 40, 70, 25)
;~ GUICtrlSetOnEvent($Button1, "file")
;~ GUICtrlSetOnEvent($Button2, "write")
;~ GUICtrlSetOnEvent($Button3, "read")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
file()
Case $Button2
write()
Case $Button3
read()
EndSwitch
WEnd
Func file()
$findgamea = FileOpenDialog("选择游戏主程序", "", "游戏主程序 (*.exe)", GUICtrlRead($Input1), "D2loader.exe", $Form1)
If Not FileExists($findgamea) = 0 Then
GUICtrlSetData($Input1, $findgamea)
EndIf
EndFunc ;==>file
Func write()
$a = GUICtrlRead($Input1)
IniWrite("config.ini", "path", "exename", $a)
MsgBox(0,"","写入完成")
EndFunc ;==>write
Func read()
$b = IniRead("config.ini", "path", "exename", "")
MsgBox(0, "", $b)
EndFunc ;==>read