主题:关于控制鼠标的问题
Public Class Form1
Inherits System.Windows.Forms.Form
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)
Public Const MOUSEEVENTF_LEFTDOWN = &H2 '模拟鼠标左键按下
Public Const MOUSEEVENTF_LEFTUP = &H4 '模拟鼠标左键释放
Public Const MOUSEEVENTF_MIDDLEDOWN = &H20 '模拟鼠标中间键按下
Public Const MOUSEEVENTF_MIDDLEUP = &H40 '模拟鼠标中间键释放
Public Const MOUSEEVENTF_RIGHTDOWN = &H8 '模拟鼠标右键按下
Public Const MOUSEEVENTF_RIGHTUP = &H10 '模拟鼠标右键释放
Public Const MOUSEEVENTF_MOVE = &H1 '模拟鼠标指针移动
#Region " Windows 窗体设计器生成的代码 "
#End Region
Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
mouse_event(MOUSEEVENTF_MOVE, 50, 100, 0, 0)
End Sub
End Class
我想让鼠标指针移动到50,100的屏幕处!
为什么鼠标只沿X轴上下移动 而不能沿Y轴左右移动
是代码有问题吗?希望高手指点 !谢谢
Inherits System.Windows.Forms.Form
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)
Public Const MOUSEEVENTF_LEFTDOWN = &H2 '模拟鼠标左键按下
Public Const MOUSEEVENTF_LEFTUP = &H4 '模拟鼠标左键释放
Public Const MOUSEEVENTF_MIDDLEDOWN = &H20 '模拟鼠标中间键按下
Public Const MOUSEEVENTF_MIDDLEUP = &H40 '模拟鼠标中间键释放
Public Const MOUSEEVENTF_RIGHTDOWN = &H8 '模拟鼠标右键按下
Public Const MOUSEEVENTF_RIGHTUP = &H10 '模拟鼠标右键释放
Public Const MOUSEEVENTF_MOVE = &H1 '模拟鼠标指针移动
#Region " Windows 窗体设计器生成的代码 "
#End Region
Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
mouse_event(MOUSEEVENTF_MOVE, 50, 100, 0, 0)
End Sub
End Class
我想让鼠标指针移动到50,100的屏幕处!
为什么鼠标只沿X轴上下移动 而不能沿Y轴左右移动
是代码有问题吗?希望高手指点 !谢谢