[Help]Auto Clicker VB2008

Need help with my autoclicker

Page 1 of 1

4 Replies - 35612 Views - Last Post: 10 January 2011 - 02:43 AM Rate Topic: -----

#1 koolazngy94  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 119
  • Joined: 29-July 08

[Help]Auto Clicker VB2008

Posted 16 October 2008 - 05:20 PM

I need help with this code. I'm not sure what is wrong here. When I run it, Nothing happens. The word Start doesn't change to Stop and it won't click.

Public Class Form1

	Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
		LeftClick()
	End Sub

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		If CommandType.Text = "Start" Then
			Timer1.Enabled = True
			CommandType.Text = "Stop"
			TextBox1.Enabled = False
		Else
			Timer1.Enabled = False
			CommandType.Text = "Start"
			TextBox1.Enabled = True
		End If
	End Sub

	Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
		If Val(TextBox1.Text) < 0.01 Then
			TextBox1.Text = "1"
		End If
		Timer1.Interval = Val(TextBox1.Text) * 1000
	End Sub

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

	End Sub
End Class



odule Module1
	Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
	Public Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
	Public Declare Function GetCursorPos Lib "user32" (ByVal lpPoint As POINTAPI) As Long
	Public Const MOUSEEVENTF_LEFTDOWN = &H2
	Public Const MOUSEEVENTF_LEFTUP = &H4
	Public Const MOUSEEVENTF_MIDDLEDOWN = &H20
	Public Const MOUSEEVENTF_MIDDLEUP = &H40
	Public Const MOUSEEVENTF_RIGHTDOWN = &H8
	Public Const MOUSEEVENTF_RIGHTUP = &H10
	Public Const MOUSEEVENTF_MOVE = &H1
	Public Structure POINTAPI
	x as long
	y As Long 
	End Structure
	Public Function GetX() As Long
		Dim n As POINTAPI
		GetCursorPos(n)
		GetX = n.x
	End Function
	Public Function GetY() As Long
		Dim n As POINTAPI
		GetCursorPos(n)
		GetY = n.Y

	End Function
	Public Sub LeftClick()
		LeftDown()
		LeftUp()
	End Sub
	Public Sub LeftDown()
		mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
	End Sub
	Public Sub LeftUp()
		mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
	End Sub
	Public Sub MiddleClick()
		MiddleDown()
		MiddleUp()
	End Sub
	Public Sub MiddleDown()
		mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0)
	End Sub
	Public Sub MiddleUp()
		mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0)
	End Sub
	Public Sub RightClick()
		RightDown()
		RightUp()
	End Sub
	Public Sub RightDown()
		mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
	End Sub
	Public Sub RightUp()
		mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
	End Sub
	Public Sub MoveMouse(ByVal xMove As Long, ByVal yMove As Long)
		mouse_event(MOUSEEVENTF_MOVE, xMove, yMove, 0, 0)
	End Sub
	Public Sub SetMousePos(ByVal xPos As Long, ByVal yPos As Long)
		SetCursorPos(xPos, yPos)
	End Sub
End Module


Can someone fix this?It said I have 7 Errors and I don't know how to fix them.

This post has been edited by koolazngy94: 16 October 2008 - 05:28 PM


Is This A Good Question/Topic? 0
  • +

Replies To: [Help]Auto Clicker VB2008

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: [Help]Auto Clicker VB2008

Posted 16 October 2008 - 05:25 PM

First this is VB.NET code so I'm moving this to the VB.NET forum, second whats the problem? Is there an error, is it not doing what you want? You need to provide information like this before we can even begin to help :)
Was This Post Helpful? 0
  • +
  • -

#3 koolazngy94  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 119
  • Joined: 29-July 08

Re: [Help]Auto Clicker VB2008

Posted 16 October 2008 - 05:35 PM

sorry i didn't know hwere it goes.
Was This Post Helpful? 0
  • +
  • -

#4 spac3crow  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-August 09

Re: [Help]Auto Clicker VB2008

Posted 23 August 2009 - 09:09 PM

I checked out your codes and yes i found some errors in it.

in your module, you have declared a structure like this:
Public Structure POINTAPI
		 x As Long
		 y As Long
	End Structure



which is wrong coz the variables are not properly declared.
it should be coded like this:

Public Structure POINTAPI
		Dim x As Long
		Dim y As Long
	End Structure



That should fix your Module.
And with regards to your form,
It is better if you set the Timer's Interval from it's property window.

NOTE:
You must have these controls in your form.

button
Name: Button1

Label
Name: CommandType



Here's the new code:

Public Class Form1

	Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
		LeftClick()
	End Sub

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		If CommandType.Text = "Start" Then
			Timer1.Enabled = True
			CommandType.Text = "Stop"
		Else
			Timer1.Enabled = False
			CommandType.Text = "Start"
		End If
	End Sub


End Class



Module Module1
	Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
	Public Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
	Public Declare Function GetCursorPos Lib "user32" (ByVal lpPoint As POINTAPI) As Long
	Public Const MOUSEEVENTF_LEFTDOWN = &H2
	Public Const MOUSEEVENTF_LEFTUP = &H4
	Public Const MOUSEEVENTF_MIDDLEDOWN = &H20
	Public Const MOUSEEVENTF_MIDDLEUP = &H40
	Public Const MOUSEEVENTF_RIGHTDOWN = &H8
	Public Const MOUSEEVENTF_RIGHTUP = &H10
	Public Const MOUSEEVENTF_MOVE = &H1
	Public Structure POINTAPI
		Dim x As Long
		Dim y As Long
	End Structure
	Public Function GetX() As Long
		Dim n As POINTAPI
		GetCursorPos(n)
		GetX = n.x
	End Function
	Public Function GetY() As Long
		Dim n As POINTAPI
		GetCursorPos(n)
		GetY = n.Y

	End Function
	Public Sub LeftClick()
		LeftDown()
		LeftUp()
	End Sub
	Public Sub LeftDown()
		mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
	End Sub
	Public Sub LeftUp()
		mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
	End Sub
	Public Sub MiddleClick()
		MiddleDown()
		MiddleUp()
	End Sub
	Public Sub MiddleDown()
		mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0)
	End Sub
	Public Sub MiddleUp()
		mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0)
	End Sub
	Public Sub RightClick()
		RightDown()
		RightUp()
	End Sub
	Public Sub RightDown()
		mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
	End Sub
	Public Sub RightUp()
		mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
	End Sub
	Public Sub MoveMouse(ByVal xMove As Long, ByVal yMove As Long)
		mouse_event(MOUSEEVENTF_MOVE, xMove, yMove, 0, 0)
	End Sub
	Public Sub SetMousePos(ByVal xPos As Long, ByVal yPos As Long)
		SetCursorPos(xPos, yPos)
	End Sub

End Module


Was This Post Helpful? 0
  • +
  • -

#5 Guest_Bozha*


Reputation:

Re: [Help]Auto Clicker VB2008

Posted 10 January 2011 - 02:43 AM

View Postkoolazngy94, on 16 October 2008 - 04:35 PM, said:

sorry i didn't know hwere it goes.


In vb6 variable of type Long is Integer in VB.net
Othervise it wont work, i.e. instead of

Structure POINTAPI
Dim x as long
dim y as long
end structure

u should use

Structure POINTAPI
Dim x as int32
dim y as int32
end structure
Was This Post Helpful? 0

Page 1 of 1