1.滑鼠移動 XY就是您的座標 至於如何移動到"畫面正中央位置" 就自己算了~
Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Sub MoveMouse()
Dim X As Integer
Dim Y As Integer
X = 500
Y = 150
Call SetCursorPos(X, Y)
End Sub
2.滑鼠設定
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)
Sub SetMouse()
Call mouse_event(&H2 Or &H4, 0, 0, 0, 0)
End Sub
&H2 就是左鍵按下
&H4 就是左鍵放開
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Public Function GethWnd() As Long
Dim lpPoint As POINTAPI
GetCursorPos lpPoint
GethWnd = WindowFromPoint(lpPoint.X, lpPoint.Y)
MsgBox lpPoint.X
MsgBox lpPoint.Y
End Function