|
-
Sep 10th, 2000, 02:17 PM
#1
Thread Starter
Lively Member
Does anyone know how to move the mouse around automatically, and stop when it comes over a particular piece of text or an image.
-
Sep 10th, 2000, 02:20 PM
#2
_______
<?>
Code:
'an example of how to move a mouse using API
'
'=================================================
'Bas Module Code
Option Explicit
Public Type POINTAPI
x As Long
y As Long
End Type
Public Declare Function ClientToScreen Lib _
"user32" (ByVal hwnd As Long, lpPoint As POINTAPI) _
As Long
Declare Function SetCursorPos Lib "user32" _
(ByVal x As Long, ByVal y As Long) As Long
'===================================================
'Form Code
Option Explicit
Sub MoveMouse(x As Single, y As Single)
Dim sPoint As POINTAPI
sPoint.x = x
sPoint.y = y
ClientToScreen hwnd, sPoint
SetCursorPos sPoint.x, sPoint.y
End Sub
Private Sub Command1_Click()
MoveMouse Target.Left + Target.Width / 2, _
Target.Top + Target.Height / 2
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 10th, 2000, 07:41 PM
#3
Hyperactive Member
Warning
Be careful, dude.
I wouldn´t like my mouse roaming all over the desk!
(lol)
Combat poverty: kill a poor!!
-
Sep 10th, 2000, 07:45 PM
#4
Addicted Member
hmm... would that little roaming mouse be looking for a link to click by chance?
Generic vb 5
Private Sub WakeMyAssUp(  As Boolean)
If  Then  :  = False
End Sub
-
Sep 10th, 2000, 08:34 PM
#5
To give the mouse a bit of an effect:
Code:
Declare Function SetCursorPos Lib "user32" _
(ByVal x As Long, ByVal y As Long) As Long
Private Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)
Public Type POINTAPI
x As Long
y As Long
End Type
Private Sub Command1_Click()
For i = 100 To 300
SetCursorPos i, i: Sleep 10
DoEvents
Next i
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|