Accueil > > > DÉCLENCHER UNE ACTION À UN MOMENT PRÉCIS POUR UNE DURÉE DÉTERMINÉE
DÉCLENCHER UNE ACTION À UN MOMENT PRÉCIS POUR UNE DURÉE DÉTERMINÉE
Information sur la source
Description
Voila ! Tout est expliqué dans le code il vous faut :
-un timer
-un form
-3 boutons
Source
- 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
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
COMMENT MAPPER UNE VUE SQL SUR UNE COLLECTION DE COMPLEX TYPE?COMMENT MAPPER UNE VUE SQL SUR UNE COLLECTION DE COMPLEX TYPE? par Matthieu MEZIL
Avec EF, les vues doivent être mappées sur des entity types. Le problème c'est que les entity types doivent avoir une clé. Avec EF, nous avons les complex type qui n'ont pas de clé mais les vues ne peuvent pas être mappées dessus. Avec EF4, il est possibl...
Cliquez pour lire la suite de l'article par Matthieu MEZIL [WF4] UN BINDING ACTIVITY/ACTIVITYDESIGNER QUI PASSE MAL?[WF4] UN BINDING ACTIVITY/ACTIVITYDESIGNER QUI PASSE MAL? par JeremyJeanson
Certain d'entre vous on peut être vécu cette situation embarrassante après quelques temps passer avec WF4 : Au début avec mon " ActivityDesigner" , tout allait bien. Et puis un jour j'ai au des problèmes de " Binding" . Alors nous sommes allé sur le site ...
Cliquez pour lire la suite de l'article par JeremyJeanson MYTIC - SHAREPOINT 2010 : DéJà UN MYTHE MICROSOFT ?MYTIC - SHAREPOINT 2010 : DéJà UN MYTHE MICROSOFT ? par junarnoalg
La prochaine session de MyTIC aura lieu à Namur, le 23 mars prochain. Pendant presque une heure, nous parlerons de SharePoint 2010. Voici un aperçu du programme.
Accueil : 17h30 Début de la session : 18h00 - Les nouvelles int...
Cliquez pour lire la suite de l'article par junarnoalg
Logiciels
Academy System (10.9.4.0)ACADEMY SYSTEM (10.9.4.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Xilisoft Convertisseur Vidéo Ultimate (5.1.39.0305)XILISOFT CONVERTISSEUR VIDéO ULTIMATE (5.1.39.0305)Xilisoft Convertisseur Vidéo Ultimate est un outil puissant de conversion vidéo, facile à utilise... Cliquez pour télécharger Xilisoft Convertisseur Vidéo Ultimate Xilisoft DVD Ripper Ultimate (5.0.64.0304)XILISOFT DVD RIPPER ULTIMATE (5.0.64.0304)Xilisoft DVD Ripper Ultimate est un logiciel excellent pour copier et convertir DVD vers presque ... Cliquez pour télécharger Xilisoft DVD Ripper Ultimate Rigs of Rods (63.3)RIGS OF RODS (63.3)c'est un jeu de multi-simulation camions,autobus voitures, avions, bateaux, hélicoptère avec défo... Cliquez pour télécharger Rigs of Rods
Comparez les prix

HTC Hero
Entre 550€ et 550€
|