Posted on 2002-04-24
I have a form with a textbox on it and an array of buttons with the alphabet on them. The idea is for the user to click the buttons with a mouse and the letters will be placed into the textbox.
I didn't want the user to use the keyboard (mouse only) so i placed a timer on the form to check the keys pressed and if pressed it would call a function warning them not to use the keyboard.
My problem is what code would I place into the timer below which would allow the user to click the mouse on the button array, have the letter entered into the textbox but not trigger the Mobile1 function should the keyboard be used instead of the mouse:
Private Sub Timer1_Timer()
Dim KeyPressed As String
Dim Counter As Integer
For Counter = 1 To 255
If GetAsyncKeyState(Counter) <> 0 Then
' Check if key has been pressed
KeyPressed = CheckKey(Counter)
If KeyPressed <> "" Then
'Key was pressed, keyboard being used, call Mobile1
Thanks in advance