Option Explicit
Private Sub avv_Click()
If az = 1 Then
Timer1.Enabled = True
avv.Caption = "Pausa"
az = 2
ElseIf az = 2 Then
Timer1.Enabled = False
avv.Caption = "Avvia"
az = 1
End If
End Sub
Private Sub Form_Load()
Call Control_windows
Me.Caption = App.Title & " " & App.Major & "." & App.Minor
az = 1
Call azzera
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Form2
Unload Me
End
End Sub
Private Sub mod_Click()
nul = 1
Form2.Show 1
End Sub
Private Sub res_Click()
Timer1.Enabled = False
az = 1
avv.Caption = "Avvia"
Call azzera
End Sub
Sub azzera()
sec = Form2.secondi.Text
min = Form2.minuti.Text
ore = Form2.orer.Text
cron = Form2.giorni.Text
sec_t.Caption = sec
min_t.Caption = min
ore_t.Caption = ore
cron_t.Caption = cron
Call Controlla
End Sub
Private Sub Timer1_Timer()
Call Cronometro
Call Controlla
End Sub
Sub Cronometro()
'inizio secondi
If sec = 0 Then
If min = 0 Then
If ore = 0 Then
If cron = 0 Then
If Form2.nada.Value = True Then
MsgBox "Conto alla rovescia eseguito con successo!", vbInformation, App.Title
ElseIf Form2.filee.Value = True Then
glPid = Shell(filedir, vbNormalFocus)
Timer2.Enabled = True
ElseIf Form2.spegn.Value = True Then
Call Shutdown(EWX_POWEROFF)
Timer2.Enabled = True
ElseIf Form2.riav.Value = True Then
Call Shutdown(EWX_REBOOT)
Timer2.Enabled = True
End If
Timer1.Enabled = False
az = 1
avv.Caption = "Avvia"
Call azzera
Else
cron = cron - 1
ore = 23
min = 59
sec = 59
ore_t.Caption = ore
cron_t.Caption = cron
min_t.Caption = min
sec_t.Caption = sec
End If
'--------
Else
ore = ore - 1
min = 59
sec = 59
min_t.Caption = min
ore_t.Caption = ore
sec_t.Caption = sec
End If
'--------
Else
min = min - 1
sec = 59
sec_t.Caption = sec
min_t.Caption = min
End If
'--------
Else
sec = sec - 1
sec_t.Caption = sec
End If
'fine secondi
End Sub
Private Sub Timer2_Timer()
Timer2.Enabled = False
Unload Form2
Unload Me
End
End Sub