Option Explicit Dim Gauche As Boolean, Espace As Boolean Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Timer1.Enabled = True If KeyCode = vbKeyLeft Then 'on a enfoncé la touche "Flèche Gauche" Gauche = True If Espace Then ' si "Espace" a déjà été enfoncée MsgBox "gagné !" End If End If If KeyCode = vbKeySpace Then 'on a enfoncé la touche "Espace" Espace = True If Gauche Then MsgBox "Gagné !!!" End If End If End Sub Private Sub Form_Load() Timer1.Interval = 200 ' délai maximal : 2/10 de seconde entre les 2 frappes End Sub Private Sub Timer1_Timer() Gauche = False ' Réinitialisation Espace = False ' si délai dépassé End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyA Then Select Case Shift Case 1: MsgBox "Maj+A" Case 2: MsgBox "Ctrl+A" Case 3: MsgBox "Ctrl+Maj+A" End Select End If End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question