如何使程序根据我告诉它单击的 x 和 y 坐标单击某个位置?现在我有:mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 1)
但是当它执行时,无论我的鼠标在哪里,它都会点击,无论我传递给它的 x 和 y 坐标是什么。
这是确切的代码:
For n = 0 To dt2.Rows.Count - 1
command = dt2.Rows(n)("Command")
pos = dt2.Rows(n)("Position")
x = Mid(pos, 21, 4)
y = Mid(pos, 28, 3)
Try
If command = "" Then
End If
If command = "Double Click" Then
mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 1)
mouse_event(MOUSEEVENTF_RIGHTUP, x, y, 0, 1)
End If
If command = "Left Click" Then
mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 1)
End If
If command = "Right Click" Then
mouse_event(MOUSEEVENTF_RIGHTDOWN, x, y, 0, 1)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Next
dt2
是一个数据表