- Declare Sub SetWindowPos Lib "User" (ByVal hWnd As Integer, ByVal hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer)
- Dim drapeau As Integer, heure_f As Integer, minute_f As Integer, drapeau1 As Integer, tempo As Integer, limite0 As Integer
- Dim limite As String
-
- Sub Commande1_Click ()
- h$ = Now
- bon% = 0
- fin$ = Texte1.Text
- If Len(fin$) <> 5 Then
- bon% = 1
- Else
- If Asc(Mid$(fin$, 5, 1)) > 57 Or Asc(Mid$(fin$, 5, 1)) < 48 Then
- bon% = 1
- End If
- If Asc(Mid$(fin$, 4, 1)) > 57 Or Asc(Mid$(fin$, 4, 1)) < 48 Then
- bon% = 1
- End If
- If Asc(Mid$(fin$, 2, 1)) > 57 Or Asc(Mid$(fin$, 2, 1)) < 48 Then
- bon% = 1
- End If
- If Asc(Mid$(fin$, 1, 1)) > 57 Or Asc(Mid$(fin$, 1, 1)) < 48 Then
- bon% = 1
- End If
- End If
- If Right$(h$, 2) = "PM" Then
- If Val(Left$(fin$, 2)) > 11 Then
- bon% = 1
- End If
- Else
- If Val(Left$(fin$, 2)) > 23 Then
- bon% = 1
- End If
- End If
- If Val(Right$(fin$, 2)) > 59 Then
- bon% = 1
- End If
- limite = Texte2.Text
- If limite <> "" Then
- limite0 = Val(limite)
- If limite0 > 32767 Then
- bon% = 1
- End If
- For k% = 1 To Len(limite)
- If Asc(Mid$(limite, k%, 1)) > 57 Or Asc(Mid$(limite, k%, 1)) < 48 Then
- bon% = 1
- End If
- Next k%
- Else
- bon% = 1
- End If
- If bon% = 0 Then
- heure_fin$ = Left$(fin$, 2)
- heure_f = Val(heure_fin$)
- If Right$(h$, 2) = "PM" Then
- heure_f = heure_f + 12
- End If
- minute_fin$ = Right$(fin$, 2)
- minute_f = Val(minute_fin$)
- drapeau = 1
- Feuille1.Visible = False
- Else
- bon% = 0
- MsgBox "Erreur de saisie"
- End If
-
- End Sub
-
- Sub Commande2_Click ()
- terminer
- End Sub
-
- Sub Form_Load ()
- Minuterie1.Interval = 4000
- End Sub
-
- Sub Minuterie1_Timer ()
- If drapeau = 1 Then
- heure$ = Now
- heure_courante$ = Hour(heure$)
- heure_c% = Val(heure_courante$)
- minute_courante$ = Minute(heure$)
- minute_c% = Val(minute_courante$)
- If heure_c% = heure_f Then
- If minute_c% = minute_f Then
- drapeau = 0
- drapeau1 = 1
- drapeau = 0
- Feuille2.Show
- SetWindowPos Feuille2.hWnd, -1, 0, 0, 0, 0, &H50
- End If
- End If
- End If
- If drapeau1 = 1 Then
- tempo = tempo + 4
- If tempo > limite0 + 4 Then
- Feuille2.Hide
- Unload Feuille2
- terminer
- End If
- End If
-
- End Sub
-
- Sub terminer ()
- Unload Me
- End Sub
Declare Sub SetWindowPos Lib "User" (ByVal hWnd As Integer, ByVal hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer)
Dim drapeau As Integer, heure_f As Integer, minute_f As Integer, drapeau1 As Integer, tempo As Integer, limite0 As Integer
Dim limite As String
Sub Commande1_Click ()
h$ = Now
bon% = 0
fin$ = Texte1.Text
If Len(fin$) <> 5 Then
bon% = 1
Else
If Asc(Mid$(fin$, 5, 1)) > 57 Or Asc(Mid$(fin$, 5, 1)) < 48 Then
bon% = 1
End If
If Asc(Mid$(fin$, 4, 1)) > 57 Or Asc(Mid$(fin$, 4, 1)) < 48 Then
bon% = 1
End If
If Asc(Mid$(fin$, 2, 1)) > 57 Or Asc(Mid$(fin$, 2, 1)) < 48 Then
bon% = 1
End If
If Asc(Mid$(fin$, 1, 1)) > 57 Or Asc(Mid$(fin$, 1, 1)) < 48 Then
bon% = 1
End If
End If
If Right$(h$, 2) = "PM" Then
If Val(Left$(fin$, 2)) > 11 Then
bon% = 1
End If
Else
If Val(Left$(fin$, 2)) > 23 Then
bon% = 1
End If
End If
If Val(Right$(fin$, 2)) > 59 Then
bon% = 1
End If
limite = Texte2.Text
If limite <> "" Then
limite0 = Val(limite)
If limite0 > 32767 Then
bon% = 1
End If
For k% = 1 To Len(limite)
If Asc(Mid$(limite, k%, 1)) > 57 Or Asc(Mid$(limite, k%, 1)) < 48 Then
bon% = 1
End If
Next k%
Else
bon% = 1
End If
If bon% = 0 Then
heure_fin$ = Left$(fin$, 2)
heure_f = Val(heure_fin$)
If Right$(h$, 2) = "PM" Then
heure_f = heure_f + 12
End If
minute_fin$ = Right$(fin$, 2)
minute_f = Val(minute_fin$)
drapeau = 1
Feuille1.Visible = False
Else
bon% = 0
MsgBox "Erreur de saisie"
End If
End Sub
Sub Commande2_Click ()
terminer
End Sub
Sub Form_Load ()
Minuterie1.Interval = 4000
End Sub
Sub Minuterie1_Timer ()
If drapeau = 1 Then
heure$ = Now
heure_courante$ = Hour(heure$)
heure_c% = Val(heure_courante$)
minute_courante$ = Minute(heure$)
minute_c% = Val(minute_courante$)
If heure_c% = heure_f Then
If minute_c% = minute_f Then
drapeau = 0
drapeau1 = 1
drapeau = 0
Feuille2.Show
SetWindowPos Feuille2.hWnd, -1, 0, 0, 0, 0, &H50
End If
End If
End If
If drapeau1 = 1 Then
tempo = tempo + 4
If tempo > limite0 + 4 Then
Feuille2.Hide
Unload Feuille2
terminer
End If
End If
End Sub
Sub terminer ()
Unload Me
End Sub