
March 29th, 2013, 07:56 AM
|
|
Registered User
|
|
Join Date: Mar 2013
Posts: 13
Time spent in forums: 1 h 47 m 35 sec
Warnings Level: 5
Reputation Power: 0
|
|
|
Hello
Quote: | Originally Posted by Night1505 Have you tried putting your SendKeys("a") in a loop for a certain time? I mean, I know it sounds kinda silly, but all a "key hold" really is, is a series of repeated key presses.
Maybe try putting the call to SendKeys in a Timer Control's Tick event, and set the tick interval to like 100ms or something. Then, for say a 10 second key hold, run the Timer Control for 100 Ticks.
Perhaps something like:
Public Class Lane1test
Public ticks As Integer = 0
Public wshshell As Object
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wshshell = CreateObject("WScript.Shell")
Dim wsh As Object = CreateObject("WScript.Shell")
'Using WScript to execute Stuff
wsh = CreateObject("WScript.Shell")
' Open URWebCam.exe
wshshell.Run("c:\Documents and Settings\ed\Desktop\Racer30\URWebCam.exe", 9)
' Give URWebCam time to load
wsh.Sleep(500)
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'keypress the A button
wshshell.SendKeys("a")
If ticks > 100 Then
Timer1.Stop()
Me.Close()
End If
ticks += 1
End Sub
End Class |
Hello,
The idea is not bad, but it probably will not work. in this way, it all depends on the speed of computers and the results could be very bad.
|