Skip to content

Cursor lock for Windows.

Press Ctrl+Alt+Win+G in a game and the mouse pointer stays inside its window, so it can't slide onto your second monitor. Ctrl+Alt+Win+U lets it go.

Mouse Pointer is in Pro and the free 14-day trial. No script to write.

Ctrl+Alt+Win+G locks the cursor to the window in front.

Mouse Pointer keeps the pointer inside that window until Ctrl+Alt+Win+U lets it go. The lock stays after the macro has finished.

Both keys live in one macro. The emergency stop, Ctrl+Alt+End, always lets the pointer go too.

The macro Cursor lock running in MacroWin: two monitors side by side with a game on the left one. Ctrl+Alt+Win+G is pressed and Mouse Pointer locks the pointer inside the game's window. The pointer moves right and stops at the window's edge, while a faint copy shows where it would have gone on the second monitor. Ctrl+Alt+Win+U lets it go, and the pointer crosses over to the second monitor.

Set it up.

Install in MacroWin

Needs Pro or the free 14-day trial. It arrives switched off.

Or in MacroWin: Ctrl+N, then pick the Cursor lock template.

MacroWin didn't open

MacroWin doesn't seem to be installed on this PC. Download it and install it, then click Install in MacroWin again.

Already have it? Update it to the latest version, or open the Macro Hub in MacroWin and search there.

Download MacroWin

Or build it yourself

  1. New macro, trigger Hotkey: press Ctrl+Alt+Win+G.
  2. Add Mouse Pointer: Lock, inside the window in front.
  3. In Graph view (Ctrl+Shift+L), add Hotkey Ctrl+Alt+Win+U.
  4. Wire it to another Mouse Pointer, set to Unlock.
  5. Ctrl+S, then switch Enabled on.

Variations and limits.

The same step locks the mouse to a monitor or an area, or hides the pointer.

Variations

Lock the mouse to a monitor
In the first Mouse Pointer, set Keep it inside to The monitor it's on. The pointer then stays on the monitor it was on, whatever window is in front.
An area
Keep it inside An area takes X, Y, Width and Height, in physical pixels on the whole desktop.
By itself in one game
Put App Event in place of the first Hotkey, with your game's .exe and the event Activated, and the pointer locks when the game comes to the front. A second App Event with Deactivated, wired to Unlock, lets it go when you switch away.
Hide the pointer
Set Action to Hide, such as while presenting. The pointer still moves and clicks. Show brings it back with your own pointer scheme.
Only while a macro runs
Turn off Keep after the macro ends and the lock is undone as soon as the macro finishes. Put the steps that need it after Mouse Pointer.

Limits

Getting out
Ctrl+Alt+Win+U lets the pointer go. The emergency stop, Ctrl+Alt+End, always lets it go too, from any app.
The window in front
It locks to the window in front, so click into the game first. With no window in front it can't lock, and Mouse Pointer goes on along Failed.
Games
MacroWin is made to automate your own work and play. It isn't made for cheating or for getting around anti-cheat. Many online games forbid macros, and using one there can get your account banned, so follow each game's rules. Read Play fair.

FAQ

How do I stop my mouse going to the second monitor in a game?

Switch the Cursor lock macro on, click into the game and press Ctrl+Alt+Win+G. The mouse pointer stays inside the game's window until you press Ctrl+Alt+Win+U, so it can't slide onto the second monitor.

Do I need to write a script?

No. You pick steps from a list and fill in their settings, or install the ready-made macro from this page. There is no code or script to write.

Can it lock the mouse to one monitor instead of a window?

Yes. In the first Mouse Pointer step, set Keep it inside to The monitor it's on. It can also keep the pointer inside an area you set by X, Y, width and height.

How do I unlock the cursor?

Press Ctrl+Alt+Win+U. The emergency stop, Ctrl+Alt+End, always lets it go too, from any app. Until then the lock stays, even after the macro has finished.

Does it turn on by itself when the game starts?

The template uses keys, but it can. Put App Event in place of the first Hotkey, with your game's .exe and the event Activated, and the pointer locks whenever the game comes to the front. A second App Event with Deactivated, wired to the Unlock step, lets it go when you switch away.

Does it work with borderless windowed games?

It keeps the pointer inside the window in front, whatever kind of window it is. To keep it on a whole monitor instead, set Keep it inside to The monitor it's on.

Is the cursor lock free?

MacroWin itself is free. Mouse Pointer is a Pro step, in the free 14-day trial too, and Pro is a one-time payment.

Read more about it.

Every step has its own page with all its settings, and the guides explain the ideas behind them.

Get the cursor lock

Free, no account needed. Windows 10 and 11.

Download