如何用VB实现鼠标自动移动?

解决方案 »

  1.   

    使用如下API获得或者设置鼠标的位置:
    Public Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
    Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    Public Type POINTAPI
            x As Long
            y As Long
    End Type
    Public Declare Function GetDesktopWindow Lib "user32" () As Long
    Public ptMove As POINTAPI使用下面的语句就可以移动鼠标了,单位是像素。
    SetCursorPos ptMove.x, ptMove.y