An autoclicker?
(Mine)
Code:
Public Class Autoclicker
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private 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)
Private Const mouseclickup = 4
Private Const mouseclickdown = 2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Interval = TextBox1.Text
Timer1.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
mouse_event(mouseclickdown, 0, 0, 0, 0)
mouse_event(mouseclickup, 0, 0, 0, 0)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Timer2.Enabled = True
Timer2.Interval = 1
Dim Alt As Boolean
Dim Z As Boolean
Alt = GetAsyncKeyState(Keys.Menu)
Z = GetAsyncKeyState(Keys.Z)
If Alt And Z = True Then
Call Button1_Click(Button1, e)
End If
Dim X As Boolean
Alt = GetAsyncKeyState(Keys.Menu)
X = GetAsyncKeyState(Keys.X)
If Alt And X = True Then
Call Button2_Click(Button2, e)
End If
End Sub
Private Overloads Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim isKey As Boolean = Char.IsDigit(e.KeyChar)
Dim isDecimal As Boolean = e.KeyChar.ToString = "."
If Not isKey And Not isDecimal Then
e.Handled = True
End If
End Sub
End Class
Oh yeah, can you improve on it somehow? VB code analysis says it's messy.
Warning 1 CA1060 : Microsoft.Design : Because it is a P/Invoke method, 'Autoclicker.GetAsyncKeyState(Long)' should be defined in a class named NativeMethods, SafeNativeMethods, or UnsafeNativeMethods. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 2 Multitool
Warning 6 CA1060 : Microsoft.Design : Because it is a P/Invoke method, 'Autoclicker.mouse_event(Long, Long, Long, Long, Long)' should be defined in a class named NativeMethods, SafeNativeMethods, or UnsafeNativeMethods. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 3 Multitool
Warning 13 CA1901 : Microsoft.Portability : As it is declared in your code, parameter 'cbuttons' of P/Invoke 'Autoclicker.mouse_event(Long, Long, Long, Long, Long)' will be 8 bytes wide on 32-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 4 bytes wide on 32-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Long'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 3 Multitool
Warning 14 CA1901 : Microsoft.Portability : As it is declared in your code, parameter 'cbuttons' of P/Invoke 'Autoclicker.mouse_event(Long, Long, Long, Long, Long)' will be 8 bytes wide on 64-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 4 bytes wide on 64-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Long'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 3 Multitool
Warning 15 CA1901 : Microsoft.Portability : As it is declared in your code, parameter 'dwExtraInfo' of P/Invoke 'Autoclicker.mouse_event(Long, Long, Long, Long, Long)' will be 8 bytes wide on 32-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 4 bytes wide on 32-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Long'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 3 Multitool
Warning 7 CA1901 : Microsoft.Portability : As it is declared in your code, parameter 'dwflags' of P/Invoke 'Autoclicker.mouse_event(Long, Long, Long, Long, Long)' will be 8 bytes wide on 32-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 4 bytes wide on 32-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Long'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 3 Multitool
Warning 8 CA1901 : Microsoft.Portability : As it is declared in your code, parameter 'dwflags' of P/Invoke 'Autoclicker.mouse_event(Long, Long, Long, Long, Long)' will be 8 bytes wide on 64-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 4 bytes wide on 64-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Long'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 3 Multitool
Warning 9 CA1901 : Microsoft.Portability : As it is declared in your code, parameter 'dx' of P/Invoke 'Autoclicker.mouse_event(Long, Long, Long, Long, Long)' will be 8 bytes wide on 32-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 4 bytes wide on 32-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Long'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 3 Multitool
Warning 10 CA1901 : Microsoft.Portability : As it is declared in your code, parameter 'dx' of P/Invoke 'Autoclicker.mouse_event(Long, Long, Long, Long, Long)' will be 8 bytes wide on 64-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 4 bytes wide on 64-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Long'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 3 Multitool
Warning 11 CA1901 : Microsoft.Portability : As it is declared in your code, parameter 'dy' of P/Invoke 'Autoclicker.mouse_event(Long, Long, Long, Long, Long)' will be 8 bytes wide on 32-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 4 bytes wide on 32-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Long'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 3 Multitool
Warning 12 CA1901 : Microsoft.Portability : As it is declared in your code, parameter 'dy' of P/Invoke 'Autoclicker.mouse_event(Long, Long, Long, Long, Long)' will be 8 bytes wide on 64-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 4 bytes wide on 64-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Long'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 3 Multitool
Warning 2 CA1901 : Microsoft.Portability : As it is declared in your code, parameter 'vkey' of P/Invoke 'Autoclicker.GetAsyncKeyState(Long)' will be 8 bytes wide on 32-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 4 bytes wide on 32-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Long'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 2 Multitool
Warning 3 CA1901 : Microsoft.Portability : As it is declared in your code, parameter 'vkey' of P/Invoke 'Autoclicker.GetAsyncKeyState(Long)' will be 8 bytes wide on 64-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 4 bytes wide on 64-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Long'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 2 Multitool
Warning 4 CA1901 : Microsoft.Portability : As it is declared in your code, the return type of P/Invoke 'Autoclicker.GetAsyncKeyState(Long)' will be 4 bytes wide on 32-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 2 bytes wide on 32-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Integer'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 2 Multitool
Warning 5 CA1901 : Microsoft.Portability : As it is declared in your code, the return type of P/Invoke 'Autoclicker.GetAsyncKeyState(Long)' will be 4 bytes wide on 64-bit platforms. This is not correct, as the actual native declaration of this API indicates it should be 2 bytes wide on 64-bit platforms. Consult the MSDN Platform SDK documentation for help determining what data type should be used instead of 'Integer'. C:\Users\spy\documents\visual studio 2010\Projects\Multitool\Multitool\Autoclicker.vb 2 Multitool