|
-
February 7th, 2000, 10:13 PM
#1
Little better explaination for Detection
i no hwo to detect key board press combinations, but i dont no how to detect them anywhere on the desktop, i mean anywhere on the screen. please help
-
February 7th, 2000, 11:54 PM
#2
Re: Little better explaination for Detection
Use the GetAsyncKeyState() API Within a Timer Controls Timer Event, ie.
private Declare Function GetAsyncKeyState Lib "user32" (byval vKey as Long) as Integer
private Sub Form_Load()
Timer1.Interval = 10
End Sub
private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyControl) <> 0 And GetAsyncKeyState(vbKeyQ) <> 0 then
Caption = "Pressing CTRL + Q"
else
Caption = ""
End If
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
February 8th, 2000, 12:21 AM
#3
Re: Little better explaination for Detection
Here's a pretty simple way of capturing a key event anywhere:
Put this in a module:
public Declare Function GetKeyState Lib "user32" (byval nVirtKey as Long) as Integer
here's a loop that will constantly look for a keypress of 8 asynchronously:
Do
DoEvents
i = GetKeyState(56)
If i = 1 then
MsgBox "8 was pressed"
Exit Do
End If
Loop
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
|