none
Undeclared exception

    Question

  • PInvokeStackImbalance occurred
    Message: Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in 'C:\Users\lanet\Documents\Visual Studio 2015\Projects\AutoClicker\AutoClicker\bin\Debug\AutoClicker.vshost.exe'.
    Additional information: A call to PInvoke function 'AutoClicker!AutoClicker.Form1::mouse_event' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

    Public Class Form1
        Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        End Sub
        Private Sub MyMethod()
            Cursor.Position = New System.Drawing.Point(Cursor.Position)
            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

    does anyone know why i am getting this error

    i thought i declared it in line 2

    Tuesday, March 14, 2017 5:23 PM

All replies