1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| <System.Runtime.InteropServices.DllImport("user32.dll")> _
Public Shared Function GetKeyboardState(ByVal keystate As Byte()) As Integer
End Function
Private Sub Form1_KeyDown_1(ByVal sender As Object, ByVal e As KeyEventArgs) Handles Me.KeyDown
Dim keys__1 As Byte() = New Byte(254) {}
GetKeyboardState(keys__1)
Console.WriteLine("")
Console.WriteLine(keys__1(CInt(Keys.L)))
Console.WriteLine(keys__1(CInt(Keys.P)))
Console.WriteLine(keys__1(CInt(Keys.M)))
If (keys__1(CInt(Keys.Q)) = 129 OrElse keys__1(CInt(Keys.Q)) = 128) AndAlso
(keys__1(CInt(Keys.S)) = 129 OrElse keys__1(CInt(Keys.S)) = 128) Then
Console.WriteLine("deux touches qs enfoncées")
End If
If (keys__1(CInt(Keys.L)) = 129 OrElse keys__1(CInt(Keys.L)) = 128) AndAlso
(keys__1(CInt(Keys.P)) = 129 OrElse keys__1(CInt(Keys.P)) = 128) AndAlso
(keys__1(CInt(Keys.M)) = 129 OrElse keys__1(CInt(Keys.M)) = 128) Then
Console.WriteLine("Trois touches lpm enfoncées")
End If
End Sub |
Partager