Question[Source Help]Spot the problem in this

Posts 1–12 of 12 · Page 1 of 1
[Source Help]Spot the problem in this
Code:
Public Class Form1
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If GetAsyncKeyState(Keys.F3) Then
            Timer2.Start()
        End If
        If GetAsyncKeyState(Keys.F4) Then
            Timer2.Stop()
        End If
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Dim value As Point
        value = Cursor.Position
        Cursor.Position = value
        Me.Cursor = New Cursor(Cursor.Current.Handle)
        Cursor.Position = New Point(Cursor.Position.X, Cursor.Position.Y + 30)
    End Sub
End Class
That was the code for my Anti-Recoil Beta 2, which apparently fucked up but ran perfectly on my PC. Here is the full unedited code for it, which is actually quite simple. I got the Cursor.Position thing straight from the Microsoft online help/resource thingy.

Anybody know what the problem is? It's F3 to start and F4 to stop. If you can fix it successfully then I will put your name on it as well as mine. If you're gonna leech, credit me for the original.
there's no stopper for it.

Code:
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Dim value As Point
        value = Cursor.Position  << one of these is unnecessary
        Cursor.Position = value << one of these is unnecessary
        Me.Cursor = New Cursor(Cursor.Current.Handle)
        Cursor.Position = New Point(Cursor.Position.X, Cursor.Position.Y + 30)
    End Sub
what you need to do is have the hotkey F3 call a function to wait for the person to click their mouse before moving down, then when they are not clicking the mouse to stop.

the way you have the code is that when its turned on the cursor is constantly moving down.. it doesnt wait for any mouse clicks before moving down it just moves
I know, I tried everything to do the click bit with loads of different functions but none worked. Any ideas which one?
you need to wait for the mouse click not do it.. XBUTTON1 i think.. i'm not very well adapted with VB, but i think WM_LBUTTONDOWN and WM_LBUTTONUP is what you need
Code:
Dim hotkey as boolean
hotkey = GetAsyncKeyState(Keys.F3)

if hotkey = true then
' your code here!
end if
Quote Originally Posted by Grim View Post
you need to wait for the mouse click not do it.. XBUTTON1 i think.. i'm not very well adapted with VB, but i think WM_LBUTTONDOWN and WM_LBUTTONUP is what you need
Thanks, I'll try it in a minute.

Quote Originally Posted by Zoom View Post
Code:
Dim hotkey as boolean
hotkey = GetAsyncKeyState(Keys.F3)

if hotkey = true then
' your code here!
end if
I know that bit but we want it to work if it's on and if the mouse button is pressed.
Quote Originally Posted by Samueldo View Post
Thanks, I'll try it in a minute.



I know that bit but we want it to work if it's on and if the mouse button is pressed.
Isn´t it mouse.left?
Tried that, for some reason it doesn't like me.
humm. i tired messin with it and it froze my keys. were all good now
Quote Originally Posted by zmansquared View Post
humm. i tired messin with it and it froze my keys. were all good now
Make 2 timers, 1 for hotkey and 1 for the code
Any one got codes for unlimited respawnÉ
Samueldo i will give you the answer MOuse left is = (Keys.LButton) this is for vb 2008 express.for right its = (Keys.RButton)

Edit:
THAT Code needs to change becuase it's all wrong.For Timer1

Edit This is what i have changed so far:

Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim Hotkey1 As Boolean
If Hotkey1 = GetAsyncKeyState(Keys.F3) Then
GetAsyncKeyState(Keys.LButton)
If Hotkey1 = True Then
Timer2.Start()
End If
End If
End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Dim value As Point
value = Cursor.Position
Cursor.Position = value
Me.Cursor = New Cursor(Cursor.Current.Handle)
Cursor.Position = New Point(Cursor.Position.X, Cursor.Position.Y + 30)
End Sub
End Class
Posts 1–12 of 12 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us