Code:
Shell ("Shutdown -s -t 5")
thats waits 5 seconds before shutting down. (i think it displays the count down im not sure).
But if you must have the 00:00:00 format its pretty simple and just basic maths. i will be doing this free hand so there could be errors but you should be able to fix them up yourself.
I'll try and comment it as best i can (i hate commenting)
Code:
private sub timer1_timer()
Dim Hrs as long, Mins as long, Secs as long 'deccy's
hrs = val(split(label1.":")(0)) 'gets hrs remaining from the label
mins = val(split(label1.":")(1)) 'gets mins remaining from the label
secs = val(split(label1.":")(2)) 'gets secs remaining from the label
if hrs = 0 and mins = 0 and secs = 0 then
shell(shutdown -s) 'shuts down the comp
end if
if secs = 0 then '##### the whole of this if statement basically
if mins = 0 then '#### just minuses 1 from Label1 everytime
if not hrs = 0 then '# the timer clicks over.
hrs = hrs - 1
end if
mins = 59
else
mins = mins - 1
end if
secs = 59
else
secs = secs - 1
end if
label1 = "0" & hrs & ":" & iif(mins < 10, "0" & mins, mins) & ":" & iif(secs < 10, "0" & secs, secs) 'displays the timer as "00:00:00" type format
end sub
Stuff to know:
Label1 is the label that will be displaying the time (00:00:00).
Set timer interval to 1000.
You will need some function or way of inputting the time to the label. I suggest making a textbox where the user puts the amount of seconds he/she wants to wait then have them press a command button to format and transfer the seconds into a HR:MIN:SEC format into that label.