1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| ' // declaration -----
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
' // function -----
Public Function Mysendkeys(key As Byte, time As Long)
keybd_event key, 0, 0, 0 ' on appuis
Sleep time ' on attent
keybd_event key, 0, 2, 0 ' on lache
End Function
' // Objet -----
Private Sub Timer1_Timer()
If GetAsyncKeyState(123) <> 0 Then ' Detection de F12
Mysendkeys 38, 5 ' Envoi d'une touche du clavier ( ici touche haut )
End If ' fin
End Sub |
Partager