How can I get the current keyboard input from within my module which has no form or UI? I just want to be able to detect the Shift status with a timer event.
Any help appreciated.
Printable View
How can I get the current keyboard input from within my module which has no form or UI? I just want to be able to detect the Shift status with a timer event.
Any help appreciated.
Try this in a new module and set the startup to sub main
[This message has been edited by Azzmodan (edited 11-08-1999).]Code:Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Sub Main()
Do
If GetAsyncKeyState(vbKeyShift) <> 0 Then
MsgBox "Shift pressed"
End If
DoEvents
Loop
End Sub
Fantastic.
Thanks for the help, works a treat.