Lock the mouse to my application
-
Hi! I want to lock the mouse to my application with a key-combination. By lock I mean in a way that you can't move the mouse outside the window of my application. I want to unlock the mouse with the same key-combination (e.g. Ctrl+l). Is that possible? Can anyone help he? Thanks Erik
-
Hi! I want to lock the mouse to my application with a key-combination. By lock I mean in a way that you can't move the mouse outside the window of my application. I want to unlock the mouse with the same key-combination (e.g. Ctrl+l). Is that possible? Can anyone help he? Thanks Erik
Hi you need to call
ClipCursor
APIBOOL ClipCursor(
CONST RECT *lpRect // screen coordinates
);check MSDN for more info.
-
Hi you need to call
ClipCursor
APIBOOL ClipCursor(
CONST RECT *lpRect // screen coordinates
);check MSDN for more info.
-
Actually, just use the
Cursor.Clip
property already provided in the .NET FCL. As far as being a no-no, just make sure you restore the clipping region (the desktop area) after you're done - even in case of error.Microsoft MVP, Visual C# My Articles