|
樓主 |
發表於 16-9-12 09:04
|
顯示全部樓層
仔仔: 非常謝謝您的回覆.
整個運作原理是--- 模擬滑鼠移到某個位置, 然後 Click. 如果 click這個動作成功,那麼被Click的網頁"自然地"Focus住, 全部的程式碼就下面幾行而已.
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal y As Long) As Long
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 timeGetTime Lib "winmm.dll" () As Long
Sub delay(ByVal n As Single)
Dim tm1 As Long, tm2 As Long
tm1 = timeGetTime
Do
tm2 = timeGetTime
If (tm2 - tm1) / 1000 > n Then Exit Do
DoEvents
Loop
End Sub
Sub 按鈕1_Click()
SetCursorPos 1430, 400 '移動游標
mouse_event 2, 0, 0, 0, 0 '左鍵按下
mouse_event 4, 0, 0, 0, 0 '左鍵放開'
delay 1 '休息1秒
SendKeys "123456789" '送出字串
End Sub
仔仔所言 "AppActivate" " 和sendkeys 有用tab 換control focus" 不知如何使用,
願聞其詳,Thanks.
|
|