Question[HELP] Press-to-activate[Solved]

Posts 1–15 of 15 · Page 1 of 1
[HELP] Press-to-activate[Solved]
Yeh. I know this is really basic, but I just need to like activate a timer if you press a key. Like press F11 and activates, F12 stops. Yeah I'm new to VB. I thank if someone helps meh
Hotkey. Search the tutorials thread.

or folllow this:

[php]Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer[/php]

Then add another timer

And under Form1_Load

[php]Timer1.enabled = true
Timer1.interval = 1[/php]

Then under your timer2.tick
[php]Dim F11 As Boolean[/php]

And then this

[php]F11 = GetAsyncKeyState(Keys.F11)

If F11 = True Then
Timer1.Start
end if[/php]

So then you have this

[php]Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Timer1.enabled = true
Timer1.interval = 1

End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick

Dim F11 As Boolean


F11 = GetAsyncKeyState(Keys.F11)


If F11 = True Then
Timer1.Start

end if
End Class[/php]

Do the same for F12 as stop, so instead replace Timer2.Start with Timer2.Stop
Here's a cool tutorial I wrote up (not leeched or anything )

Hotkey. Search the tutorials thread.

or folllow this:

[php]Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer[/php]

Then add another timer

And under Form1_Load

[php]Timer1.enabled = true
Timer1.interval = 1[/php]

Then under your timer2.tick
[php]Dim F11 As Boolean[/php]

And then this

[php]F11 = GetAsyncKeyState(Keys.F11)

If F11 = True Then
Timer1.Start
end if[/php]

So then you have this

[php]Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Timer1.enabled = true
Timer1.interval = 1

End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick

Dim F11 As Boolean


F11 = GetAsyncKeyState(Keys.F11)


If F11 = True Then
Timer1.Start

end if
End Class[/php]

Do the same for F12 as stop, so instead replace Timer2.Start with Timer2.Stop
Quote Originally Posted by Lolland View Post
Here's a cool tutorial I wrote up (not leeched or anything )

Hotkey. Search the tutorials thread.

or folllow this:

[php]Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer[/php]

Then add another timer

And under Form1_Load

[php]Timer1.enabled = true
Timer1.interval = 1[/php]

Then under your timer2.tick
[php]Dim F11 As Boolean[/php]

And then this

[php]F11 = GetAsyncKeyState(Keys.F11)

If F11 = True Then
Timer1.Start
end if[/php]

So then you have this

[php]Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Timer1.enabled = true
Timer1.interval = 1

End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick

Dim F11 As Boolean


F11 = GetAsyncKeyState(Keys.F11)


If F11 = True Then
Timer1.Start

end if
End Class[/php]

Do the same for F12 as stop, so instead replace Timer2.Start with Timer2.Stop
Quote Originally Posted by Invidus View Post
Hotkey. Search the tutorials thread.

or folllow this:

[php]Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer[/php]

Then add another timer

And under Form1_Load

[php]Timer1.enabled = true
Timer1.interval = 1[/php]

Then under your timer2.tick
[php]Dim F11 As Boolean[/php]

And then this

[php]F11 = GetAsyncKeyState(Keys.F11)

If F11 = True Then
Timer1.Start
end if[/php]

So then you have this

[php]Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Timer1.enabled = true
Timer1.interval = 1

End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick

Dim F11 As Boolean


F11 = GetAsyncKeyState(Keys.F11)


If F11 = True Then
Timer1.Start

end if
End Class[/php]

Do the same for F12 as stop, so instead replace Timer2.Start with Timer2.Stop
Both c&p
WTF? You fucking cheapos :P
They have been multiple tutorials & even a module for that -.-

Search before asking.
Screw that, THEY C+P-ed ME!!
GTFO Hej stop stealing my creditz :P
Okay, back on topic and marked solved
BUT THEY STOLE MY CREDS!! But okay,good job, hope it helped PVP
That's been around for a long time. It's not yours.
Quote Originally Posted by Dead Bones Brook View Post
You both forgot 'End Sub'.
It's a protection against choobs that C&P
Posts 1–15 of 15 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us