Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Gestione spegnimento PC - frmMain.frm

frmMain.frm

Caricato da: Roberto VB
Scarica il programma completo

  1. Option Explicit
  2. Dim lConta As Long
  3. Dim X As Long
  4. Private Sub cmdOrganizza_Click()
  5.     On Error GoTo errore
  6.     Timer1.Enabled = True
  7.     txtTimer.Locked = True
  8.     lConta = txtTimer.Text
  9.     Exit Sub
  10. errore:
  11.     MsgBox Err.Description, vbCritical, "ERRORE"
  12.     End
  13. End Sub
  14.  
  15. Private Sub Command1_Click()
  16.     Timer1.Enabled = False
  17.     txtTimer.Locked = False
  18. End Sub
  19.  
  20. Private Sub Form_Load()
  21.     lConta = 0
  22. End Sub
  23.  
  24. Private Sub Form_Unload(Cancel As Integer)
  25.     MsgBox "Creato da Roberto VB"
  26.     End
  27. End Sub
  28.  
  29. Private Sub optShutdown_Click(Index As Integer)
  30.     Select Case Index
  31.         Case 0
  32.             txtValore.Text = "0"
  33.         Case 1
  34.             txtValore.Text = "1"
  35.         Case 2
  36.             txtValore.Text = "2"
  37.         Case 3
  38.             txtValore.Text = "4"
  39.     End Select
  40.            
  41.        
  42. End Sub
  43.  
  44. Private Sub Timer1_Timer()
  45.  
  46.     lConta = lConta - 1
  47.     lblTimer.Caption = lConta
  48.     'Se lConta è uguale a 0 allora spegne o riavvia il pc
  49.     If lConta <= 0 Then
  50.         Timer1.Enabled = False
  51.         X = ExitWindowsEx(txtValore.Text, 0&)
  52.     End If
  53. End Sub