Ho un form in cui è presente un checkbox(auto_poweroff_pc) e un label con l'orario prestabilito per la chiusura(timeselected)
devo creare una funzione che (al verificarsi di timeselected.Caption = Time e al verificarsi di auto_poweroff_pc.Value = 1) mi spenga automaticamente il pc (indipendentemente dal sistema operativo).
Ho provato a usare questo codice ma al momento dello spegnimento mi ricarica il programma e mi da un errore
come posso fare???Private Sub Timer1_Timer()
If timeselected.Caption = Time Then
Unload frmMain
Unload Me
Unload frmTools
Unload frmInfo
Unload frmUseronline
If auto_poweroff_pc.Value = 1 Then
Shell ("Shutdown -S -F -T 5")
Else
End
End If
End If