How I can know when the user of my VB application press more than one letter on the keyboard ( combination like the letter "a" and the letter "c" pressed at the same moment)? Any suggestion will be appreciated.
Thanks.
Printable View
How I can know when the user of my VB application press more than one letter on the keyboard ( combination like the letter "a" and the letter "c" pressed at the same moment)? Any suggestion will be appreciated.
Thanks.
What you can use is the API function
GetAsyncKeyState
IE
If GetAsyncKeyState(VK_DOWN) <> 0 Then (user pressed down)
You could poll in a timer all the keys that you are interested in.
See the Lander game demo from this site for example code.
HTH
Geoff
Well, the computer can not actually do two things at once (like processing two inputs), but in any case, you can limit the user to one key press at a time and/or validate that input by putting code like the following in the KeyPress event:
The above restricts the user to entering A, B or C in either upper or lower case.Code:Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim sChar As String
sChar = Chr(KeyAscii)
Select Case UCase(sChar)
Case "A", "B", "C"
MsgBox "I'm OK"
Case Else
KeyAscii = 0
MsgBox "I'm Not Valid"
End Select
End Sub
------------------
Marty