PDA

Click to See Complete Forum and Search --> : MOUSE MOVING pls help me


AbsoluteB
Jun 23rd, 2000, 07:06 PM
Hi,

i read all the posts about mouse moving in this board.
The posts are really good.
BUT...
how can i make the mouse move not just
from one point to another.
I want the mouse to move from
Point1 to Point2 to Point3 ...
and then back to Point1 again.
And then restart!

Pls help me!
I'm a newbie in VB-Coding!

Thanks

AbsoluteB

Jun 23rd, 2000, 08:35 PM
You can use the SetCursorPos or the mouse_event API to accomplish this.

AbsoluteB
Jun 23rd, 2000, 09:21 PM
Hmmmm

ok

Thank's

Didn't I say that I'm a Newbie??

;(

CU

AbsoluteB

Jun 23rd, 2000, 10:52 PM
Saying you are a Newbie really cannot tell me your level of knowledge in a certain field.

Anyhow, I can try to explain further. Below is the declaration for the Function. Paste it into a module. I have added the Sleep function as well to slow the process down


Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


Put this code into a CommandButton on the Form


Private Sub Command1_Click()

' Make a loop to move the mouse
For i = 1 To 300
Sleep 10 ' Slow the process down by pausing for 10ms
DoEvents ' Make sure Windows doesn't freeze
SetCursorPos 100 + i, 100 + i ' Move the cursor to 100 + i
Next i

End Sub

AbsoluteB
Jun 24th, 2000, 12:56 AM
THANKS A LOT!!!

You're great!!

CU

AB