Post: [VB.NET][Source]Mouse Mover
05-09-2011, 11:37 PM #1
(adsbygoogle = window.adsbygoogle || []).push({});
Originally posted by kingdeath360 View Post
[size=large]Mouse Mover - VB.NET[/size]

Basically this simple program moves the mouse choosing from two different methods.

  1. Method - Moving the mouse to the correct Y Position, then Moving it to the X Position.
  2. Method - Going Diagonally till it reaches it's target destination.


Screenshot:
You must login or register to view this content.

Download for Source-Code:
You must login or register to view this content.

Virus Scan:
You must login or register to view this content.

Source Code (I recommend you download the source for better understanding)

    

Imports System.Windows.Forms
Public Class Form1

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim randomnum As New Random
Dim randres As String = randomnum.Next(1, 100)
If randres >= "50" Then
Cursor.Position = New Point(100, 100)
BackgroundWorker2.RunWorkerAsync()
ElseIf randres <= "49" Then
Cursor.Position = New Point(100, 100)
BackgroundWorker1.RunWorkerAsync()
End If
End Sub

Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
BackgroundWorker1.ReportProgress(100)
End Sub

Private Sub BackgroundWorker1_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged
Try
Do
If Cursor.Position.Y.ToString < numericupdown2.value Then
Cursor.Position = New Point(Cursor.Position.X, Cursor.Position.Y + "1")
Threading.Thread.Sleep(1)
ElseIf Cursor.Position.Y.ToString > numericupdown2.value Then
Cursor.Position = New Point(Cursor.Position.X, Cursor.Position.Y - "1")
Threading.Thread.Sleep(1)
End If
Loop Until Cursor.Position = New Point(Cursor.Position.X.ToString, NumericUpDown2.Value)
Do
If Cursor.Position.X.ToString < numericupdown1.value Then
Cursor.Position = New Point(Cursor.Position.X + "1", Cursor.Position.Y)
Threading.Thread.Sleep(1)
ElseIf Cursor.Position.X.ToString > numericupdown1.value Then
Cursor.Position = New Point(Cursor.Position.X - "1", Cursor.Position.Y)
Threading.Thread.Sleep(1)
End If
Loop Until Cursor.Position = New Point(NumericUpDown1.Value, Cursor.Position.Y.ToString)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub BackgroundWorker2_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker2.DoWork
BackgroundWorker2.ReportProgress(100)
End Sub

Private Sub BackgroundWorker2_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker2.ProgressChanged
Try
Dim MYS As String = Cursor.Position.Y.ToString
Dim MXS As String = Cursor.Position.X.ToString
Do
If Cursor.Position.Y.ToString < numericupdown2.value Then
Cursor.Position = New Point(Cursor.Position.X, Cursor.Position.Y + "1")
Threading.Thread.Sleep(1)
ElseIf Cursor.Position.Y.ToString > numericupdown2.value Then
Cursor.Position = New Point(Cursor.Position.X, Cursor.Position.Y - "1")
Threading.Thread.Sleep(1)
End If
If Cursor.Position.X.ToString < numericupdown1.value Then
Cursor.Position = New Point(Cursor.Position.X + "1", Cursor.Position.Y)
Threading.Thread.Sleep(1)
ElseIf Cursor.Position.X.ToString > numericupdown1.value Then
Cursor.Position = New Point(Cursor.Position.X - "1", Cursor.Position.Y)
Threading.Thread.Sleep(1)
End If

Loop Until Cursor.Position = New Point(NumericUpDown1.Value, NumericUpDown2.Value)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class



Hope this helps in some way,
- Yui.

its a c&p///////////////////////////////

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo