PInvokeStackImbalance wurde erkannt.
Message: Ein Aufruf an die PInvoke-Funktion „Geistmouse!WindowsApplication1.Form1::mouse_event“ hat das Gleichgewicht des Stapels gestört. Wahrscheinlich stimmt die verwaltete PInvoke-Signatur nicht mit der nicht verwalteten Zielsignatur überein. Überprüfen Sie, ob die Aufrufkonvention und die Parameter der PInvoke-Signatur mit der nicht verwalteten Zielsignatur übereinstimmen.
wird mir bei
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
angezeigt
vollständiger code ist
Public Class Form1
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 MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
Me.Text = Cursor.Position.ToString
End Sub
Private Sub Button2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button2.MouseMove
Me.Text = Cursor.Position.ToString
End Sub
Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
Me.Text = Cursor.Position.ToString
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = Cursor.Position.X.ToString
Label2.Text = Cursor.Position.Y.ToString
If CInt(Label1.Text) Me.Left + Button2.Left + (Button2.Width / 2)
Label1.Text = CStr(CInt(Label1.Text) - 1)
Cursor.Position = New Point(CInt(Label1.Text), CInt(Label2.Text))
Me.Refresh()
Loop
End If
If CInt(Label2.Text) Me.Top + Button2.Top + 25 + (Button2.Height / 2)
Label2.Text = CStr(CInt(Label2.Text) - 1)
Cursor.Position = New Point(CInt(Label1.Text), CInt(Label2.Text))
Me.Refresh()
Loop
End If
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub
Private Sub Form1_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move
Label3.Text = CStr(Me.Left + Button2.Left.ToString)
Label4.Text = CStr(Me.Left + Button2.Top.ToString)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button2.Text = CStr(CInt(Button2.Text) + 1)
End Sub
End Class
Was Mache ich Falsch