Answered by:
Autoclick program

Question
-
Hello!
I want to create a simple autoclick program. What I want to to is a program that makes a click were the mouse cursor is at every 5 minutes (or at any defined period of time) for instance.
I searched the web but I didnt find any examples.
Thank you!
Friday, July 29, 2011 8:53 AM
Answers
-
Assuming you're dealing around your form, because IMHO creating a program that clicks everywhere on the screen (that can be done using API like here) sounds a irritating experience for a computer user. So, if you'd like to click around your programmatically, create a MouseEventArgs and use a timer like this:
See my answer here:
http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/9d68ff70-41c8-4f65-8f32-77fe50ebd920
For example click on every 5 minutes which means 300000 ms interval that is the value must be set as Timer's interval, then:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim arg As New MouseEventArgs(Windows.Forms.MouseButtons.Left, _
1, Windows.Forms.Cursor.Position.X, Windows.Forms.Cursor.Position.Y, Nothing)
Me.OnMouseClick(arg)
End Sub' See a proof (optional), move your cursor around (inside) your form WITHOUT clicking and wait till timer's click event fires:
Private Sub Form1_click(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseClick
Dim g As Graphics = Me.CreateGraphics
g.DrawString("X", New Font("Arial", 20), Brushes.Black, e.Location.X, e.Location.Y)
End Sub..a X will be drawn programmatically which is caused by mouse-click simulation.
HTH.
Best regards, Saygılarımla, Onur Güzel
Yazgeliştir Forumları VB.NET / C# Süper Moderatorü.
Microsoft Haber Grupları Profilim (VB.NET)
- Edited by Onur Güzel Friday, July 29, 2011 12:55 PM
- Proposed as answer by Mike Feng Monday, August 1, 2011 10:29 AM
- Marked as answer by Mike Feng Monday, August 8, 2011 12:57 PM
Friday, July 29, 2011 12:47 PM
All replies
-
Hey TheRealDuda,
This should be done by using the Win32 API, I have included a link to a good Wiki site which also has .Net code samples. I will not assist any further because I dont want to help you write potential malicious code.
Feanaro
Friday, July 29, 2011 11:20 AM -
Assuming you're dealing around your form, because IMHO creating a program that clicks everywhere on the screen (that can be done using API like here) sounds a irritating experience for a computer user. So, if you'd like to click around your programmatically, create a MouseEventArgs and use a timer like this:
See my answer here:
http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/9d68ff70-41c8-4f65-8f32-77fe50ebd920
For example click on every 5 minutes which means 300000 ms interval that is the value must be set as Timer's interval, then:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim arg As New MouseEventArgs(Windows.Forms.MouseButtons.Left, _
1, Windows.Forms.Cursor.Position.X, Windows.Forms.Cursor.Position.Y, Nothing)
Me.OnMouseClick(arg)
End Sub' See a proof (optional), move your cursor around (inside) your form WITHOUT clicking and wait till timer's click event fires:
Private Sub Form1_click(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseClick
Dim g As Graphics = Me.CreateGraphics
g.DrawString("X", New Font("Arial", 20), Brushes.Black, e.Location.X, e.Location.Y)
End Sub..a X will be drawn programmatically which is caused by mouse-click simulation.
HTH.
Best regards, Saygılarımla, Onur Güzel
Yazgeliştir Forumları VB.NET / C# Süper Moderatorü.
Microsoft Haber Grupları Profilim (VB.NET)
- Edited by Onur Güzel Friday, July 29, 2011 12:55 PM
- Proposed as answer by Mike Feng Monday, August 1, 2011 10:29 AM
- Marked as answer by Mike Feng Monday, August 8, 2011 12:57 PM
Friday, July 29, 2011 12:47 PM -
Onur,
Did you read the message from Feanaro, he has given in my idea the correct reply. Take also a look at this link which he probably assumes most people know that.
http://en.wikipedia.org/wiki/Autoclicker
And than especially about controversial usage.
Also be aware of this thread in top of this forum
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/053a0a87-e9b8-42e7-b483-d6d47c41278e
Success
CorFriday, July 29, 2011 12:55 PM -
Onur,
Did you read the message from Feanaro, he has given in my idea the correct reply. Take also a look at this link which he probably assumes most people know that.
http://en.wikipedia.org/wiki/Autoclicker
And than especially about controversial usage.
Also be aware of this thread in top of this forum
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/053a0a87-e9b8-42e7-b483-d6d47c41278e
Success
CorYep, and that's why i DID NOT posted the whole screen-click (autoclicker) code using API, though it seems other people have posted it previously which i referenced above, and my post covers the same concerning statement.
Best regards, Saygılarımla, Onur Güzel
Yazgeliştir Forumları VB.NET / C# Süper Moderatorü.
Microsoft Haber Grupları Profilim (VB.NET)Friday, July 29, 2011 12:59 PM