誰可以給我滑鼠右鍵 載電腦螢幕不規則的亂點呢????
就點一次過3秒再點別的地方
就是可以調節 點的速度....10點哦!!
2006-12-09 14:24:56 · 1 個解答 · 發問者 Shin 1 in 電腦與網際網路 ➔ 軟體
'版本:VB6.0
'表單置一個CommandButton,一個Timer1及一個TextBox;可改變TextBox的值來調整時間.
Const MOUSEEVENTF_ABSOLUTE = &H8000
Const MOUSEEVENTF_MOVE = &H1
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
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 Function GetMessageExtraInfo Lib "user32" () As Long
Private Sub Command1_Click()
Timer1.Interval = 10
Timer1 = Not Timer1
Command1.Caption = IIf(Command1.Caption = "Start", "Stop", "Start")
End Sub
Private Sub Form_Load()
Timer1 = False
Text1 = 3000 '3秒(以1/1000為單位)
Command1.Caption = "Start"
End Sub
Private Sub Timer1_Timer()
Dim X&, Y&
Timer1.Interval = Abs(Int(Val(Text1)))
Randomize
'隨機選擇座標(X,Y)
X = Int(Rnd * (Screen.TwipsPerPixelX + 1)) * (65535 / Screen.TwipsPerPixelX)
Y = Int(Rnd * (Screen.TwipsPerPixelY + 1)) * (65535 / Screen.TwipsPerPixelY)
'滑鼠移到座標(X,Y)
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, X, Y, 0, GetMessageExtraInfo()
'按下滑鼠右鍵
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, GetMessageExtraInfo()
'放開滑鼠右鍵
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, GetMessageExtraInfo()
End Sub
2006-12-11 11:13:38 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋