vb写个小程序

来源:百度知道 编辑:UC知道 时间:2024/05/06 17:21:28
有点像外挂,但是比较简单.
实现的功能是鼠标在一个小方形内自动移动(范围不做要求,无规则移动也可以,只要在一个范围就可以了),并且每隔1秒自动点击左键一次.
不一定要vb写,只要有这样的程序就可以了
现在新的要求是在屏幕中不停移动,不能碰到四周,鼠标不用点击也可以

每隔1秒点击一次,没有范围,横向移动

Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function SetCursorPos& Lib "user32" (ByVal x As Long, ByVal y As Long)
Private Declare Function GetCursorPos& Lib "user32" (lpPoint As POINTAPI)
Private Declare Function GetWindowRect& Lib "user32" (ByVal hwnd As Long, lpRect As RECT)
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 Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private a As Single