请帮忙修改一下计时器代码
请帮忙修改下面的计时器代码,能否不用 AdlibEnable 函数?#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
Opt("TrayIconDebug", 1)
Opt("MustDeclareVars", 0)
Global $SideBar,$timer, $Secs, $Mins, $Hour, $Time
$SideBar=GUICreate("Timer", 100, 100,-1,-1,2)
GUICtrlCreateLabel("00 分 00 秒", 10, 20,90)
GUISetState()
$timer = TimerInit()
AdlibEnable("Timer", 50)
;
While 1
Sleep(100)
WEnd
;
Func Timer()
_TicksToTime(Int(TimerDiff($timer)),$Hour,$Mins, $Secs)
Local $sTime = $Time
$Time = StringFormat("%02i 分 %02i 秒",$Mins, $Secs)
If $sTime <> $Time Then ControlSetText("Timer", "", "Static1", $Time)
EndFunc ;==>Timer
[ 本帖最后由 新手上路 于 2008-10-20 11:41 编辑 ]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
Opt("TrayIconDebug", 1)
Opt("MustDeclareVars", 0)
Global $SideBar,$timer, $Secs, $Mins, $Hour, $Time
$SideBar=GUICreate("Timer", 100, 100,-1,-1,2)
GUICtrlCreateLabel("00 分 00 秒", 10, 20,90)
GUISetState()
$timer = TimerInit()
;~ AdlibEnable("Timer", 50)
;
While 1
Sleep(100)
Timer()
WEnd
;
Func Timer()
_TicksToTime(Int(TimerDiff($timer)),$Hour,$Mins, $Secs)
Local $sTime = $Time
$Time = StringFormat("%02i 分 %02i 秒",$Mins, $Secs)
If $sTime <> $Time Then ControlSetText("Timer", "", "Static1", $Time)
EndFunc ;==>Timer
谢谢!
晕,这么简单,我这么没想到呢:face (13):
页:
[1]