本帖最后由 happytc 于 2011-5-11 11:08 编辑
回复 happytc
写临时文件?
哪有写临时文件的语句啊?
3mile 发表于 2011-5-11 10:53
意思象若要在Case $iSaveButton时得到一个$iInput的值,可以从临时文件里读取
Case $iInput
FileWrite(@TempDir & "\tmp.txt", GUICtrlRead($iInput))
全代码如下, 实现没有想到更好的方法。若您有,请指教
Opt("GUIOnEventMode", 1)
Local $OKButton[10]
$hwd = GUICreate("Config", 280, 230)
GUISetOnEvent(-3, "_Event")
For $i = 0 To 9
$OKButton[$i] = GUICtrlCreateButton("OK" & $i + 1, 50, $i * 20, 50, 20)
GUICtrlSetOnEvent(-1, "_Event")
Assign($OKButton[$i], $i + 1)
Next
$iInput = GUICtrlCreateInput("", 10, 200, 50, 20)
GUICtrlSetOnEvent(-1, "_Event")
$iSaveButton = GUICtrlCreateButton("Save", 200, 200, 50, 20)
GUICtrlSetOnEvent(-1, "_Event")
GUISetState()
While 1
Sleep(100)
WEnd
Func _Event()
Switch @GUI_CtrlId
Case -3
Exit
Case $iInput
FileWrite(@TempDir & "\tmp.txt", GUICtrlRead($iInput))
Case $iSaveButton
MsgBox(0,0,FileRead(@TempDir & "\tmp.txt"))
Case $OKButton[0] To $OKButton[UBound($OKButton) - 1]
MsgBox(0, "pressed", "Pressed OK Button" & Eval(@GUI_CtrlId))
;Exit
EndSwitch
EndFunc ;==>_Event
|