關於我自己

2012年5月5日 星期六

滑鼠作標偵測

目的:滑鼠作標偵測,意思是到時候可以設置讓滑鼠自動執行重複的動作

例如:訂火車票,一直按到有車票,但是按鍵的作標幾乎都不變,就可以使用此偵測




程式碼:
Option Explicit
Private Type PointAPI
      X As Long
      y As Long
End Type
Dim MousePos As PointAPI

Private Declare Function GetCursorPos Lib "user32" (lpPoint As PointAPI) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Sub Timer1_Timer()

Dim IntR As Long
IntR = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
GetCursorPos MousePos
    Text1 = MousePos.X
    Text2 = MousePos.y

End Sub

沒有留言:

張貼留言