|
-
Nov 9th, 2000, 09:03 PM
#1
If i am holding down both the Down arrow key and the z key, but they control different things, how can I tell if both are down?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Nov 9th, 2000, 10:24 PM
#2
Frenzied Member
You can use GetASynchKeyState:
Public Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer
Harry.
"From one thing, know ten thousand things."
-
Nov 10th, 2000, 12:33 AM
#3
Use like:
Code:
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyControl) Then
If GetAsyncKeyState(vbKeyZ) Then
MsgBox "ctrl+z"
End If
End If
End Sub
-
Nov 10th, 2000, 08:13 AM
#4
transcendental analytic
Getasynckeystate isn't nessesary if you use shift/ctrl/alt + a key.
BTW, if you use getanynckeystate to get seval keypresses, put them in keydown event instead of a timer, that will save you some resources and performance.
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 90 And Shift = 2 Then MsgBox "Ctrl-Z"
End Sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|