VB.NET 2019 || How to send mouse click outside of the app #Easy_Code

preview_player
Показать описание
you will need button + timer
code :

Public Class Form1

Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtaInfo As Integer)
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Me.Text = Cursor.Position.ToString()
' we will need that for our example
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' we need that button : when we click on it . it send mouse cursor to our program exit location and simulate click automatically
' first we need to decalre the sub which will allow us to do that simulation
Cursor.Position = New Point(1020, 180) ' this point can be changed at your screen , its not fixed point
' now we want it to simulate the auto click
System.Threading.Thread.Sleep(1000)
mouse_event(&H2, 0, 0, 0, 0) ' This simulate left mouse click down
mouse_event(&H4, 0, 0, 0, 0) ' this simulate left mouse click up
' lets make it little slower
End Sub
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If MessageBox.Show("are you want to exit ?", "exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No Then
e.Cancel = True
End If
End Sub
End Class
Рекомендации по теме
Комментарии
Автор

cool, well done my friend . keep it up !

cpt.magwich
Автор

do you have autoclick on specific apps?

lestercorpuz
Автор

Please watch the Stronghold Crusader training video

hadimostafayi