原帖由 ceoguang 于 2009-1-17 03:56 发表 http://www.autoitx.com/images/common/back.gif
呵呵,我再来增加个难题
#include
#include
#include
$Form = GUICreate("例子一", 307, 81, -1, -1)
$Button1 = GUICtrlCreateButton("开始", 32, 24, 97, 33, 0)
$Button2 = GUICtrlCreateButton("停 ...
fit 本来就是每500毫秒运行一次的,楼上给的问题存在逻辑错误
如果要实现楼上的问题,可以加上一个判断,可以变成这样
#include
#include
#include
$Form = GUICreate("例子一", 307, 81, -1, -1)
$Button1 = GUICtrlCreateButton("开始", 32, 24, 97, 33, 0)
$Button2 = GUICtrlCreateButton("停止", 176, 24, 97, 33, 0)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_TIMER, "WM_TIMER")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Global $i = 0
$iTimeProgres4 = _Timer_SetTimer($Form, 100)
Case $Button2
_Timer_KillTimer($Form, $iTimeProgres4)
MsgBox(0, "结果", $i)
EndSwitch
WEnd
Func WM_TIMER($hWnd, $iMsg, $iwParam, $ilParam)
Switch _Timer_GetTimerID($iwParam)
Case $iTimeProgres4
fit()
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_TIMER
Func fit()
If $i >= 100 Then
_Timer_KillTimer($Form, $iTimeProgres4)
MsgBox(0, "结果", $i)
Return
EndIf
$i += 1
TrayTip("脚本正在循环中", "目的是第" & $i & "次", 10, 1)
EndFunc ;==>fit
[ 本帖最后由 superflq 于 2009-2-5 13:44 编辑 ]
非常感谢 _Timer_SetTimer 的代码
这个问题困扰我很久了...
进来学习。。
学习 留名 明天按
学习了{:face (356):}
要试试看。
Global Const $GUI_EVENT_CLOSE = -3
Global Const $GUI_EVENT_MINIMIZE = -4
Global Const $GUI_EVENT_R ...
superflq 发表于 2008-12-12 15:10 http://www.autoitx.com/images/common/back.gif
学习了 谢谢分享啊
顶了!学到东西了,谢谢各位前辈!
学习学习,感谢!