Timing Countdown

Posts 114 of 14 · Page 1 of 1
Timing Countdown
Ok i need help to code this:

Pressing down the key "D" for only 10 milliseconds. after that it will stop.
how would i do that?
User32 commands!

Too lazy to write up, but you can find it on MSDN.

There's one address for sending the key "D" then one for lifting the key "D".

It's the same as an auto clicker, there's one for sending the click, and one for lifting the click.
make a timer of 1 millisecond
make it enabled

dim number as string

Timer1.Tick
if number <= 10 then
sendkeys.send(keys.d)
number = number + 1
else
timer1.enabled = false
end if
end sub
Quote Originally Posted by mnpeepno2 View Post
make a timer of 1 millisecond
make it enabled

dim number as string

Timer1.Tick
if number <= 10 then
sendkeys.send(keys.d)
number = number + 1
else
timer1.enabled = false
end if
end sub
Could work and I advice to use Integer instead of string
yea agree...why would you pick a string for numbers =P
i dunno its what came to my mind at the time...
wat if i want to make it hold "D" down for 5 seconds.

right now the code:
Code:
Timer1.Tick
if number <= 5000 then
sendkeys.send(keys.d)
number = number + 1
else
timer1.enabled = false
end if
end sub
It keeps clicking "D" for 5 seconds.
Learn User32 key commands!

Google it.

It's complicated but it's the only way to solve your problem.
would someone be able to post a tut on user32.dll for key presses.
Quote Originally Posted by ppl2pass View Post
would someone be able to post a tut on user32.dll for key presses.
Code:
Timer1.Tick
if number <= 5000 then
sendkeys.send(keys.d)
number = number + 1000
else
timer1.enabled = false
end if
end sub
Code:
Timer1.Interval = 1000
timer1.enabled = true
Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
timer.tick...

Code:
Dim f1 As Boolean

        f1 = GetAsyncKeyState(Keys.F1)

        If f1 = True Then
         'your code
        End If
thanks would this code work i wanted to hold the key "D" for 5 seconds?

Code:
 Timer1
Dim f1 As Boolean
        Dim number As String


        f1 = GetAsyncKeyState(Keys.F1)

        If f1 = True Then
            Timer1.Interval = 1000
            Timer1.Enabled = True
            If number <= 5000 Then
                SendKeys.Send(Keys.D)
                number = number + 1000
            End If
        End If
btw when i press f2 the numbers 68 show up.
Code:
Dim f1 As Boolean
        Dim number As String


        f1 = GetAsyncKeyState(Keys.F1)

        If f1 = True Then
            Timer1.Interval = 1000
            Timer1.Enabled = True
            If number <= 5000 Then
                SendKeys.Send(Keys.D)
                number = number + 1000
            End If
        End If
Will work, however, it will not hold the keydown , it will press it, on and off..
Nextgen is a FREKIN beast at helping people. along with lolland
Posts 114 of 14 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?