这段代码和楼主的比较相似,关键就看你的循环是怎样的,希望能给你启发。#Include <Date.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Dim $i
$Form1 = GUICreate("计时+时间循环", 300, 200, -1, -1)
$Button1 = GUICtrlCreateButton("开始", 40, 60, 100, 30, 0)
$Button2 = GUICtrlCreateButton("停止", 160, 60, 100, 30, 0)
$Label1 = GUICtrlCreateLabel("准备就绪", 58, 130, 180, 50, $SS_CENTER)
GUICtrlSetFont(-1, 15, 800, 0, "楷体_GB2312")
$Label2 = GUICtrlCreateLabel(_now(),180,180)
$Label3 = GUICtrlCreateLabel("当前系统时间:", 105, 180)
GUISetState(@SW_SHOW)
While 1
$OLDT=GUICtrlRead($Label2)
$NEWT=_now()
If $NEWT<>$OLDT Then GUICtrlSetData($Label2,$NEWT)
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Button1
$a = GUICtrlRead($Button1)
If $a = "开始" Then
$i = 0
AdlibEnable('cont', 1000)
Else
AdlibEnable('cont', 1000)
EndIf
Case $Button2
AdlibDisable()
GUICtrlSetData($Label1,"暂停至"&$i&"秒")
GUICtrlSetData($Button1,"继续")
EndSwitch
WEnd
Func cont()
$i += 1
GUICtrlSetData($Label1,"已开始"&$i&"秒")
EndFunc
|