|
-
Jun 4th, 2000, 06:16 PM
#1
Thread Starter
Guru
I have to create a program that moves the mouse cursor around the screen and stops when the user touches the mouse.
I know that it can be created in VB, I have a program which does it and it was created with VB, I just really need the code.
Help?
-
Jun 4th, 2000, 07:15 PM
#2
Junior Member
Well, I am guessing you use some type of iteration loop with the setcursorpos API to perform the mouse movement (I don't know of any other way). Immediately after the setcursorpos, store the x and y values using getcursorpos. Now, right before the setcursorpos, compare the current x and y values with the stored ones.
Code:
Dim p as Point
Dim p2 as Point
Call GetCursorPos(p)
Do
Call GetCursorPos(p2)
If p.x <> p2.x Then Exit Sub
If p.y <> p2.y Then Exit Sub
SetCursorPos(whatever coordinates)
Call GetCursorPos(p)
Call TimeOut(0.02)
Loop (Until Other Condition?)
I hope this helps.
[Edited by CreepingDeath on 06-05-2000 at 08:27 AM]
-
Jun 4th, 2000, 08:12 PM
#3
Thread Starter
Guru
DOH!!! Why didn't I think of that? Thanks a lot!
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
|