Okay so there are plenty of samples for mouse global hooking.
My issue is how can I add a timer/delay for mouse movement.
What is the way of doing this? I thought maybe I should Thread.Sleep() on detecting WM_MOUSEMOVE ?
if (MouseMessages.WM_MOUSEMOVE == (MouseMessages)wParam)
{
Thread.Sleep(delay)
}
Thanks.
i'm afraid you cannot slow down the mouse movement in this way. Here you are just notified of a new mouse position, the system doesn't care what you do with this notification and how long it takes to complete, or if it sleeps.
I suppose you should "record" the mouse position every "delay" time, and then every time a new WM_MOUSEMOVE event arrives (and the coordinates are different from the record ones), then you should "reset" the mouse cursor position to the saved coordinates.
of course, this until the WM_MOUSEMOVE arrives within "delay" time. Otherwise just record a new position and wait for the next event.
.NET have the Cursor.Position property that should allow you to move the mouse cursor where you want, other languages should have their analogous, but i've never tried it and i'm not sure it operates correctly in your "global" context.
anyway messing around with the cursor position is something that can make the user very upset
maybe you don't want to stop completely the cursor for "delay" time, maybe you want to linear interpolate the new position with the previous one with a <1 factor? this will slow down the mouse but with a smoother effect.