|
-
Feb 8th, 2002, 04:10 PM
#1
Thread Starter
New Member
detecting keys pressed
hi
I can detect all the keys pressed except for the shift, alt and ctrl buttons. The code below i was using to test that i could detect them. As far as i can tell from my book i'm reading this code checks the state of the 'H' key until it is pressed. When it is pressed it then uses vkkeyscan to return an integer number. and then msgbox is used to tell me what its found. All that num ever outputs in my tests so far is 328 whether I'm pressing 'H' on its own, or Shift+H or Alt+H or Ctrl+H. So something isn't working.
Does anyone know a) why this isn't working like i've read in my book, and/or b) another way of detecting the shift key if this is way is never going to work for me??
'etc
'etc
'All the necessary declarations
Private Sub Timer1_Timer()
Dim num As Integer
num = GetAsyncKeyState(&H48)
If num <> 0 Then
num = VkKeyScan(72)
MsgBox num
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|