关于退出时保存数据的问题
我在inputbox中输入了数据,每次输入都不同 想再退出时保存以便下次运行程序时直接调用 不是设置默认值的那种请问大侠怎么办?谢谢 本帖最后由 jamer 于 2011-12-12 18:23 编辑回复 1# cumtljj
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
$Form2 = GUICreate("Save", 315, 535, 195, 143)
$posX = IniRead("save.ini","setup","posX",195)
$posY = IniRead("save.ini","setup","posY",143)
WinMove("Save","",$posX,$posY)
GUISetOnEvent($GUI_EVENT_CLOSE, "main" )
$SongName = GUICtrlCreateInput("", 48, 32, 165, 21)
$SingerName = GUICtrlCreateInput("", 48, 64, 165, 21)
GUICtrlSetData($SongName,IniRead("save.ini","setup","song","大人物"))
GUICtrlSetData($SingerName,IniRead("save.ini","setup","singer","林志炫"))
GUISetState(@SW_SHOW)
While 1
Sleep(500)
WEnd
Func main()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
IniWrite("save.ini","setup","song",GUICtrlRead($SongName))
IniWrite("save.ini","setup","singer",GUICtrlRead($SingerName))
;保存窗口位置
$pos = WinGetPos("Save")
IniWrite("save.ini","setup","posX",$pos)
IniWrite("save.ini","setup","posY",$pos)
Exit
EndSwitch
EndFunc
退出时保存输入框内容及当前窗口位置 到ini文件。重新打开窗口时候载入 退出时,把值保存在文件/注册表里
页:
[1]