Jump to content
Sign in to follow this  
igorm

Time Counter

Recommended Posts

igorm

Hi,

I'm trying to create counter for my tool which will start counting when some action starts. It's format should be 00:00:00. I have no idea how to start with this, so can somebody help me with it. Only thing I figured is that I need to use AdlibEnable. Thanks in advance for any help.

Cheers ;)

Share this post


Link to post
Share on other sites
rasim

igorm

#include <GUIConstants.au3>
#include <Date.au3>

Global $sTimer, $Dll_Timer, $hour, $min, $sec

$hGUI = GUICreate("Test", 150, 70, -1, -1)
$label = GUICtrlCreateLabel("00:00:00", 50, 15, 100, 20)

GUISetState()

$begin = TimerInit()
AdlibEnable("SetTime", 1000)

While 1
    Switch GUIGetMsg()
    Case -3
        ExitLoop
    EndSwitch
WEnd

Func SetTime()
    Local $time = _TicksToTime(Int(TimerDiff($begin)), $hour, $min, $sec)
    ControlSetText($hGUI, "", $label, StringFormat("%02i:%02i:%02i", $hour, $min, $sec))
EndFunc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×