本帖最后由 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[0])
IniWrite("save.ini","setup","posY",$pos[1])
Exit
EndSwitch
EndFunc
退出时保存输入框内容及当前窗口位置 到ini文件。重新打开窗口时候载入 |