Visual Basic mouse_event控件

时间:2018-07-17 08:47:37

标签: user32

有人可以告诉我为什么这段代码不起作用:

Public Class Form1
    Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long)
    'LEFTDOWN = &H2
    'LEFTUP = &H4
    'RIGHTDOWN = &H8
    'RIGHTUP = &H10
    'MIDDLEUP = &H40
    'MIDDLEDOWN = &H20
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Cursor = New Cursor(Cursor.Current.Handle)
        Cursor.Position = New Point(150, 150)
        mouse_event(&H2)
        Cursor.Position = New Point(250, 250)
        mouse_event(&H4)
        Cursor.Position = New Point(250, 250)
        mouse_event(&H8)
        Cursor.Position = New Point(350, 350)
        mouse_event(&H10)
    End Sub
End Class

当我尝试调试并按下按钮时,我会出错并且不知道出了什么问题 enter image description here

0 个答案:

没有答案