Click to See Complete Forum and Search --> : Capturing KeyPresses...
Set the form's KeyPreview property to True.
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = (192) Then Debug.Print ("~")
End Sub
da_silvy
Sep 20th, 2000, 09:30 PM
what does keypreview do
KeyPreview Property - Returns or sets a value that determines whether keyboard events for forms are invoked before keyboard events for controls. The keyboard events are KeyDown, KeyUp, and KeyPress.
da_silvy
Sep 20th, 2000, 11:59 PM
is there a way to do this with the mouse?
like: mousepreview?
Try this:
Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
If GetAsyncKeyState(1) Then Debug.Print "Left mouse button"
If GetAsyncKeyState(2) Then Debug.Print "Right mouse button"
End Sub
da_silvy
Sep 21st, 2000, 05:47 PM
cool, thanks
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.