写了一个计时器,想让GUI与计时器两个模块在不同的线程或进程里运行,防止GUI进程影响计时器的精确度,代码如下,请各位高人指点迷津!!#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
;let the timecount program in a singel pro
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 200, @DesktopHeight*0.125*0.5,0,0,$WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
$Label1 = GUICtrlCreateLabel("00:00:00", 0, 0, 200, @DesktopHeight*0.125*0.5,$SS_CENTER,-1)
GUICtrlSetBkColor(-1,0x00ff00)
GUICtrlSetColor(-1,000000)
GUICtrlSetFont(-1, 32, 400, 0, "Arial Black")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $SideBar,$timer, $Secs, $Mins, $Hour, $Time;set for pass time count
$timer = TimerInit() ;time count start here
While 1
Timer()
WEnd
Func Timer()
_TicksToTime(Int(TimerDiff($timer)),$Hour,$Mins, $Secs)
Local $sTime = $Time
$Time = StringFormat("%02i:%02i:%02i",$Hour,$Mins, $Secs)
If $sTime <> $Time Then ControlSetText("", "", "Static1", $Time)
EndFunc ;==>Timer
|