move mouse by a program

I need to know how to make a program that moves the mouse by its self.
Do you have eny idea?

thanks for replies!
Windows has a SetCursorPos() function.
thanks ultifinitus
I will try that! :-]
If you want a relative mouse movement function look into GetCursorPos(POINT pt);

Both are on MSDN

Clicking can be a little more difficult, but a few seconds on google will reveal some answers for you.
so the GetCursorPos(POINT pt); command maks the cursor move insted of jupumping?
so I got the SetCursorPos() command down SetCursorPos()
Hehehe C++ is fun! :-)
Dose a console program do the same thing to?
POINT is a struct with an x and a y position.

Make a new point instance

POINT pt;

call getcursorpos on it

GetCursorPos(&pt);

then use that data to move relative;

SetCursorPos(pt.x + vel.x, pt.y + vel.y);
Last edited on
With that command it stell jumps to the position insted of swiftly moving.
Last edited on
Bro.... Nevermind.

Just don't worry about smoothing...... At least until you have a firm grasp on what you're doing.
Thanks man!
Topic archived. No new replies allowed.