Is there a function that will return the pressed key that i can use in a loop??? I want to find the pressed key or keys while i am in a loop. I dont want to use the built in keyboard functions for controls. Any ideas???
Printable View
Is there a function that will return the pressed key that i can use in a loop??? I want to find the pressed key or keys while i am in a loop. I dont want to use the built in keyboard functions for controls. Any ideas???
You could use this, and it will add the keys pressed to text1
Public Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer
'the code
On Error Resume Next
Do: DoEvents
Dim X As Integer, i As Integer
For i = 32 To 256
X = GetAsyncKeyState(i)
If X = -32767 Then
text1 = text1 + Chr(i)
End If
Next
X = GetAsyncKeyState(8)
If X = -32767 Then
text1 = Mid(text1, 1, Len(text1) - 1)
End If
really? thanks! :D