Preventing Mouse Movement

Jan 14, 2012 at 10:32 PM

Hello, I am using the original source code from , so I don't know whether this issue has been successfully resolved since then.

I would like to prevent all mouse movement from occuring while a particular procedure is running.

What I have done to try to prevent mouse movement is this code in my Mouse_MoveExt event:

void Mouse_MoveExt(object sender, MouseEventExtArgs e)
    e.Handled = true;
    e = null;

This doesn't prevent mouse movement 100%.  It makes it more cumbersome to move the mouse, but it still can be moved.

I also tried setting the System.Windows.Forms.Cursor.Clip to a rectangle defined by (Cursor.Position.X, Cursor.Position.Y, 1, 1) but it is still not 100% able to stop the mouse from being moved by hand.

Is there a 100% strong way to stop mouse movement?




Jun 2, 2012 at 7:50 PM
Edited Jun 2, 2012 at 7:50 PM

Hello, I'm trying to achieve the same goal as you.

In the first few seconds it works fine, but after the initial seconds i can move the mouse as normal.

My MouseMoveExt event looks like this:

void listener_MouseMoveExt(object sender, MouseEventExtArgs e)
        e.Handled = true;

Have someone done it with success?