PDA

Click to See Complete Forum and Search --> : Keydown with no form (possible?)


DPearce
Nov 7th, 1999, 03:26 PM
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.

Nov 7th, 1999, 06:51 PM
Try this in a new module and set the startup to sub main


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


[This message has been edited by Azzmodan (edited 11-08-1999).]

DPearce
Nov 7th, 1999, 07:06 PM
Fantastic.

Thanks for the help, works a treat.