Tigervu 0 Posted October 20, 2012 Report Share Posted October 20, 2012 I've tried mutltiple different codes with this but either the program will not start clicking like it is suppose to or I get a PInvoke unbalanced stack error on the mouse events. Can someone tell me why I get these errors or why it won't work properly. I'm using Visual Studios. Public Class Form1Declare Sub mouse_event Lib "user32.dll" Alias "mouse_event" (ByVal dwFlags As Int32, ByVal dx As Int32, ByVal dy As Int32, ByVal cButtons As Int32, ByVal dwExtraInfo As Int32)Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadEnd SubPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickTimer1.Stop()End SubPrivate Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.ClickTimer1.Stop()End SubPrivate Sub MyMethod()Windows.Forms.Cursor.Position = New System.Drawing.Point(Windows.Forms.Cursor.Position) 'Draws the point, there my cusor is mouse_event(&H2, 0, 0, 0, 1) 'Cursor will go down (like a click) mouse_event(&H4, 0, 0, 0, 1) 'Cursor goes up again End Sub End SubPrivate Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.ClickTextBox1.Text = TextBox1.Text + 1End SubPrivate Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.TickMyMethod()End SubEnd Class Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.