|
-
Sep 24th, 2008, 09:55 PM
#1
Thread Starter
Addicted Member
VB 6.0: sendkey Holding a button down
I have figured out how to use sendkey to send key presses to other apps, but how would you go about sending a key press and hold to other apps?
IE: press and hold W for 10 seconds.
-
Sep 24th, 2008, 11:07 PM
#2
Re: VB 6.0: sendkey Holding a button down
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Debug.Print KeyCode
'Place your sendkey code here, it will repeatedly send the code
End Sub
-
Sep 25th, 2008, 07:18 AM
#3
Re: VB 6.0: sendkey Holding a button down
 Originally Posted by Tontow
I have figured out how to use sendkey to send key presses to other apps, but how would you go about sending a key press and hold to other apps?
IE: press and hold W for 10 seconds.
What is your end goal with this?
-
Sep 25th, 2008, 10:33 AM
#4
Thread Starter
Addicted Member
Re: VB 6.0: sendkey Holding a button down
I was playing around with sendkeys and was just wondering if it could be done without it sending tens of thoushands of repeating keypresses.
-
Sep 25th, 2008, 10:47 AM
#5
Hyperactive Member
Re: VB 6.0: sendkey Holding a button down
Place a timer on the form and perform the sendkeys in there?
Code:
Dim lngCount As Long
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Timer1.Enabled = True
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Timer1.Enabled = False
lngCount = 0
End Sub
Private Sub Timer1_Timer()
If lngCount = 10 Then
''sendkeys here
MsgBox "Key sent"
End If
lngCount = lngCount + 1
End Sub
-
Sep 25th, 2008, 05:04 PM
#6
Thread Starter
Addicted Member
Re: VB 6.0: sendkey Holding a button down
You missunderstood, I want to send the keydown and keyup events to another app.
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
|