sunflower84
Erfahrenes Mitglied
Hallo
Ich habe einen Countdown. Ich möchte gerne das dieser Countdown per Tastenkombination von vorne anfängt.
Wie mache ich denn das ?
frmTimer:
Lg
Sunflower84
Ich habe einen Countdown. Ich möchte gerne das dieser Countdown per Tastenkombination von vorne anfängt.
Wie mache ich denn das ?
frmTimer:
Code:
Option Explicit
Private Declare Function ExitWindowsEx Lib "user32" (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long
Private Const WIN_LOGOFF = 0
Dim s As Integer
Dim m As Integer
Dim h As Integer
Dim sec As Integer
Dim min As Integer
Dim hour As Integer
Dim Abbruch As Boolean
Dim frmontop As Double
Private Sub Form_Load()
' Minimieren/Maximieren Buttons zur
' Laufzeit anzeigen
MinMaxButton Me
' Fenster immer im Vordergrund anzeigen
TopWindow Me.hwnd
End Sub
Private Sub close_Click()
Dim F As Form
Abbruch = True
For Each F In Forms
Unload F
Set F = Nothing
Next
End Sub
Private Sub cmdStartTimer_Click()
Abbruch = False
Timer1.Interval = 1000
Timer1.Enabled = True
'fester Wert eintragen
s = 0
m = 1
h = 0
Label1.Caption = Format(h & " :" & m & " :" & s, "Long Time")
Do
If Abbruch = True Then Exit Do
DoEvents
cmdStartTimer.Enabled = False
If h = 0 And m = 3 And s = 0 Then
MsgBox "15 minutes allowance are over. Please finish your work now.", vbOKOnly + vbSystemModal
End If
Loop Until s = 0 And m = 0 And h = 0
Label1.ForeColor = vbRed
'MsgBox (NameC1 & "abgelaufen")
Timer1.Enabled = False
'Call ExitWindowsEx(WIN_LOGOFF, &HFFFF)
frmLock.Visible = True
Unload Me
End Sub
Private Sub Label9_Click()
End Sub
Private Sub Timer1_Timer()
s = s - 1
If s < 0 And m > 0 Then
m = m - 1
s = 59
ElseIf m <= 0 And h > 0 And s < 0 Then
h = h - 1
m = 59
s = 59
End If
Label1.Caption = Format(h & " :" & m & " :" & s, "Long Time")
End Sub
Lg
Sunflower84