Cursor Lock is a utility program that confines the mouse cursor to a selected area on the screen. This is most useful in multi-monitor setups, addressing a common oversight in some applications (mostly games) whereby they allow the mouse cursor to drift into other unwanted screens. In video games, this can also lead to minimizing the game window if the cursor has drifted into another screen and the mouse is clicked accidentally. Cursor Lock can also overcome cursor drifting problems in windowed applications and games.
Here’s a list of games that Cursor Lock is reported or confirmed to fix.
Features
- Locking only when focused–requires no special user interaction, nor does it interfere with task switching between screens
- Uses a superior method of capturing the cursor compared to other solutions (e.g. MouseTrap)
- Ability to open one program and lock another allows Cursor Lock to work well with launcher programs
- Can confine the cursor to window borders, in addition to a whole screen
- Customizable hotkeys allow for complete control of locking in any situation
- Alternate locking modes that run in the background for full user control and special circumstances
- Intuitive GUI support program for quick setup of Cursor Lock shortcuts
- Integrated help system for shortcut setup program
- Highly optimized and efficient locking program that uses practically no memory or CPU
Tutorial
Screenshots
- 2.6 Shortcut Tab on Windows 7
- 2.6 Hotkeys Tab
- 2.6 Defaults Tab
- Version 2.6 Performance
- 2.5 alpha on Win98
- 2.0 on WinXP
Download
Contribute
If Cursor Lock has fixed a game or two for you, consider supporting development with a donation.
Changelog
2.6.1 – 9/15/13
=GUI(1.6.1)
-settings are now saved to config when creating a shortcut
-improved hotkey entry
=Lock(1.2.2)
-performance improvements
2.6 – 7/3/13
=GUI(1.6)
-support for Windows Vista/7 and UAC
-cleaned up help text
-added support for translations
-icons and other UI improvements
-moved context-based help to tooltips
-converted project to .Net 3.5
-logging is now disabled by default
-updated links
2.5.2 – 5/9/12
=GUI(1.5.1)
-fixed a bug with creating shortcuts for user strict mode
2.5.1 – 10/10/09
=Lock(1.2.1)
-fixed a bug with argument passing where the program executable wasn’t given as the first argument
2.5 – 12/14/08
=Lock(1.2)
-added user and strict user modes
-added window and window interior lock regions
-code cleanup
-minor bug fixes
=GUI(1.5)
-redesigned layout to be more intuitive
-added settings for the new switches
-added about tab
-added test and self-test functions
2.11 – 1/2/08
=GUI(1.21)
-fixed a rare bug that occured when creating shortcuts to some programs with invalid filename characters in their program name
2.1 – 11/27/07
=Lock(1.1)
-Optimized the polling code to reduce the CPU usage to inpercievably small amounts while the program to lock still has focus
-at least 10x less CPU
2.0 – 11/11/07
=GUI(1.2)
-removed the lock code and set shortcut targets to the new lock app
-made sure any shortcut arguments with spaces have quotes around them. \” escapes
-added the /s switch
-removed memory minimize (/m) switch, since the new lock app doesn’t support it
=Lock(1.0)
-initial release – complete C++ rewrite of the command-line driven lock monitor
1.1 – 10/22/07
-added the /s argument, which locks the cursor to the current screen
1.0 – 2/12/06
-added hotkeys for toggling lock and exiting the lock program; should work with most keys except F10, Tab, and PrintScreen. Non-standard US keys will probably appear as a number.
-added arguments parameter for opening programs.
-added lock program parameter, allows for opening a program and locking another and locking without opening.
-added hotkey override parameter.
-better checking for valid text parameters.
-better log formatting for time.
-added help text for new elements
0.9: Initial Release
Is a pixel-border feature possible? I would like to not have Window’s taskbar rise up when the mouse touches the side of the screen
I’ve never know that to be a problem. Are you playing something in windowed mode? What version of Windows? Is your taskbar somewhere other than the bottom of the screen?
Well, no. What is needed is for the Windows taskbar preferences to have an option under “hide taskbar” that says “don’t unhide with mouse” but since that’s happening, your software is the closest thing to a fix:
If it can keep the mouse from touching border pixels, even just one, then it can keep the taskbar from flying out if your mouse gets close to the edge of the screen.
Not for games, but if you are playing a game in a window, it could theoretically be a problem.
I put my taskbar on the side, and make it very wide, so you can see the titles in it. To add insult to injury, if you touch the side of the screen, the taskbar gets in the way of what you were wanting to touch and must be hidden. You can either hit the Win key twice, or move the mouse and make another more cautious approach.
Either way it’s Windows stepping on its own foot. A regular nuisance.
I tried this program out for csgo and now when i play other games I cant alt-tab anymore and go to my second screen, please help. How can I remove this program again?
If you’re using program mode, you may have set it up incorrectly. Regardless, you’ll want figure out or set a hotkey to close Cursor Lock.
I was really hoping this would work with C&C Generals, but it doesn’t seem to do anything. Pity.
99% of people claiming Cursor Lock doesn’t work have just set it up wrong.
That could well be the case, but I’ve used your nifty utility with success on other programs, so I don’t think that’s the case here. I did notice in the earlier comments from several years ago that you indicate you don’t have any of the Command & Conquer games, so I guess it’s not possible for you to test it to see if it works on this particular one…
I had the problem where alt-tabbing out broke the cursor lock, but user mode seems to have fixed it. It would be great if the program appeared as a taskbar icon (in the bottom right corner) while running.
Maybe you have the wrong executable selected for Lock Program? With any typical program, Cursor Lock is supposed to keep running as long at the lock program is running to specifically allow for alt-tabbing.
Also, any future versions will most definitely have a taskbar icon.
Hello! First off, I’d like to say thanks for making such a fantastically useful application. It’s great for poor PC ports of console games (*cough* DARK SOULS *cough*). I have, however, been having some troubles with the application, specifically regarding hotkeys. I can’t seem to get ANY of them to work properly. I’ve tried changing the hotkey commands to all sorts of different things (most using 1-2 modifiers, as recommended), disabling my AutoHotkey program, running the application as administrator, and even running in compatibility mode (I’m using Windows 10). I don’t suppose you’ve got any ideas what may be causing this? The program’s still usable, but I’d like the ability to switch the lock on/off.
Sorry I forgot to respond to your previous comment. So can you set the hotkeys okay, i.e. do they enter into the program correctly and are they still there after re-opening Cursor Lock? Or are the hotkeys just not functioning as expected? I’ve heard of a couple games that seem to override all hotkeys, but I don’t recall if Dark Souls was one of them.
That’s the odd thing- the hotkeys don’t seem to work, regardless of what the active window is. The log doesn’t seem to indicate that anything happens when I hit the hotkeys, either.
Hotkeys don’t work for me either. I need to move the game’s window before playing but I can’t do that without a way to toggle the lock on/off.
See the part about hotkeys in the post I just published. http://www.snakebytestudios.com/2017/04/cursor-lock-faq-and-future/
Let me know if that helps or you can provide more details about the problem that might lead me to a solution. Thanks.
I was wondering if there is a chance that future versions may have a cursor position lock, so that everytime it’s not moving, it gets locked to a certain coordinate on the screen.
I don’t think so. That is a fundamentally different function and (AFAIK) fringe use case. But thanks for asking.
What about adding a border that it activates at before hitting the edge?, I’ve got a program that even at the highest poll rate it got a little outside the window before it snaps back, i think the program measures the difference in the mouse position to figure out how far to move. This results in me still clicking outside the window at times.
Sounds like the lock is lost immediately, so lowering the poll rate would not be an ideal way to fix that. I’m inclined to say that Cursor Lock is set up incorrectly (because 99% of the time, that’s the case). But just in case that isn’t what’s going on, what program are you trying to use Cursor Lock with?
Snake,
I am running Windows 7 and attempting to get Cursor Lock to work with Diablo II window mode. I have the shortcut configured as:
Open Program: Diablo II.exe
Open Program Args: -window
Lock Region: Window Interior
I also have force lock checked, and a toggle hotkey configured.
In order to open the shortcut, I have to Run as Administrator. When I do, the Diablo II window opens, but there is no locking effect. The toggle does not seem to be working either. This is the log that is being generated when I run the shortcut:
[01/09/2017 – 10:12:07 AM] App: Started.
[01/09/2017 – 10:12:07 AM] Status: Program Diablo II.exe started.
[01/09/2017 – 10:12:08 AM] Status: Closing (lockapp closed).
[01/09/2017 – 10:12:08 AM] Status: Unlocked (app closing).
[01/09/2017 – 10:12:08 AM] App: Closing.
Any thoughts?
Thank you,
Garrett
I think you’ll find that the executable you want is called game.exe.
That was it… All this time I have been using the wrong executable. Good catch, thank you! Hope you are feeling better!
Just out of curiosity, what did you code this in?
The GUI is written in VB.Net 3.5. The locker is written in C++ and the latest version compiled with VC 9.0.
Merry Christmas and a happy new year.
Can’t believe it’s already 10 years since version 1.0, and since then it’s has been an essential.
I tried others progs but I always came back for this one. Thank you for taking the time to code this nifty tool.
Thanks for the kind words. It is surprising that even now Cursor Lock is still useful. I do hope that sometime soon my health improves so that I can work on an update to it.
I’m sorry to hear you’re ill. I hope it’s nothing serious and you get well soon. Take care!
Thanks for the app, works like a charm although sometimes the mouse still manages to leave the screen a tiny bit, but enough to click outside the fullscreen game and get it minimized… it doesn’t happen to often, though. Now, I am just curious. Why is this even a problem? Why do we need cursor lock to begin with? Is there any way or do you have at least any thoughts regarding what causes this? In my case, it started to happen in Windows 10. Never had this issue in Windows XP, Windows 7, and Windows 8.1
You should try lowering the poll rate if you’re experiencing momentary Cursor escapes. Or look for other running programs that might be stealing window focus. The logging feature can help you determine what’s happening.
As to your inquiry about the origins of Cursor Lock, it’s primarily just oversight by developers. It first came to be a problem when multiple monitor setups became popular circa 2005. Few developers had any clue that the mouse cursor could actually leave the game window because it was previously always bounded by the desktop (screen) size. But with multiple monitors, the game and desktop sizes are no longer the same and thus not all sides of the game window are bounded. I think once developer knew of the problem, it was quite trivial to fix it. IIRC, the DirectX API even includes functions to “capture” the cursor, which restricts it to only the game window.
I’m not really sure why so many newer games are still afflicted with this problem, though. It’s probably a myriad of reasons: poor console/mobile ports, inexperienced indie developers, lacking backwards compatibility of Windows, or perhaps even a mere perceived increase in offenders by users that are now playing more games windowed or with multiple screens.
But anyways, I appreciate the question and your interest in the matter.
Thanks for your response, snake. I actually solved the problem that was causing this issue to being with. I use Actual Multiple Monitors (8.9.2) to manage my three screens —I have used this software since Windows 7, as it provides the best options for having multiple taskbars as far as I am concerned. Anyway, I realized that windows 10 comes with its own multiple taskbars settings, which is something not present in older windows (for instance, the option to place the taskbar buttons on the taskbar of the screen where a window is open. It still doesn’t allow as much customization as AMM does, but that’s the main functionality I need). Anyway, I activated Windows 10 native multiple-display taskbar, and disabled the one provided by AMM. And voila, problem solved. The game I was playing was Medal of Honor Allied Assault (2002), a fairly old game that never gave me problems with or without multiple displays and multiple-displays managing software. I had just started playing Infestation: The New Z (which is new) and I was having the same issues, which are now gone as well. I will still keep a copy of cursor lock just in case this issue reappears in the future.
Any plans to add a portable version in the future?
It’s already essentially portable in that settings are saved wherever the program resides. I suppose more could be done to make the program execution less dependent on a specific installation path, though.
In the future, I’d like to make Cursor Lock a background app that monitors which program has focus and applies the lock settings specified. Program Mode in the current version of Cursor Lock is good for efficiency, but not user-friendly enough for most people. This approach might also make portability easier to implement as well.
Windows 10; latest version of chrome, keep getting error that a virus was detected and I can’t install.
halp!
I think someone else mentioned this recently on youtube comments as well. It looks like it’s probably overzealous anti-virus software. I assure you there is no infection with the file that is hosted here. I even double-checked if the downloaded MD5 matched the original installer and it did. BTW, it’s a14529624223a1f4e483b07957ed7b60 for version 2.6.1, in case anyone is paranoid.
I looked into it when it gave me the same error, and windows security essentials displays it as a trojan virus.
Well, that is interesting but still inaccurate.
From this this virus scan report: “There are strong indicators suggesting that this file is safe to use.”
Some other developers using the same (popular) NSIS installer that Cursor Lock does are also reporting false positives, so I expect this to be rectified eventually.
Works on Subnautica… i havent tried other games yet but im curious if anyone knows how to fix this issue ive had since i rid my computer of a nasty virus… of course i had the issue with the mouse going out of the games (even in fullscreen) mostly because the screen would flicker my desktop everytime i clicked… if i click to fast (rapid clicking) then it ends up clicking stuff on my desktop or minimizing or closing the game… this screen flickering is the root of my issues with my mouse going outside game walls and i cant seem to fix it myself… i now play most games in windowed mode as that seems to slightly stop it from clicking out of the game but it still flickers and sometimes even acts unresponsive after a single click (that is random) and sometimes it screws me over by clicking out of game (i assume its doing that to cause this next issue) and if i was moving forward with “W” then my character keeps going even after i let go of it! i have o hit “W” again for them to stop… same with other buttons, even clicks. this doesnt happen every time but press a button or click but its pretty frequent. i am also having a constant issue with an error coming up saying my display driver has stopped but successfully recovered…. if that happens in game the screen then freezes but i can hear myself still in the game, but the screen remains frozen on what ever was happening in game when the error came up….. any fixes for these issues? you guys seem computer savy so i hope i can get some sort of help. thanks in advance.
computer is 2014 Dell Inspiron 15-3537 running Windows 10. Processor: Intel Core i5-4200U CPU 1.60GHz 2.30GHz.
What you describe sounds a lot like how a mouse cursor acts when it isn’t “locked” or “captured” by a program window. Other than that, I’m not sure what you’re getting at, although I would suggest updating your video card drivers.
Where would you find the “Open Program Args” numbers for an Origin game?
Does this work with Windows 10? I am having an issue. the cursor is sort of locked to the screen but not very well. It keeps going past the edge but then bouncing back to the edge. Makes panning very choppy and pretty much impossible. Also you still have the chance to click off the screen for the half second the cursor is over there before bouncing back.
It possible to lock (when playing league of legends) the mouse only to the center screen in nvidia surround?
I assume setting the lock region to screen instead of window would do what you want, unless Nvidia Surround makes the independent screens appear as one screen to Windows.
I tried to use this on Windows Vista and it does nothing. There is no evidence that CursorLock.exe ever successfully runs, as it’s not in the processes tab in Task Manager.
Enable logging to help you figure out why Cursor Lock might be closing prematurely. The most common cause, though, is with Program Mode if the program to lock opens and then closes for some reason, causing Cursor Lock to also open and close. It can happen so fast that you can’t even see it in Task Manager.
When in doubt, just use User Mode.
Hi. I have two (hopefully easy) feature requests that wouldn’t seem too intuitive at first but I guarantee they’d make this program the ultimate thing.
Request one – Optional horizontal and vertical mouse wrap-around within a locked window
Request two – Hiding the windows mouse cursor.
Reason: Not sure if you’re familiar with the program known as ‘Splashtop’ but it’s basically a PC remote control program that’s *almost* perfect for remote gaming. Where they are almost perfect is in the area of mouse control for FPS games. With this program and those two feature additions you’d be a god among Splashtop users.
Interesting ideas, but I think they’re out of the scope of Cursor Lock. I can’t think of any applications for cursor wrapping; most FPS games read raw input and don’t care where the cursor is on the screen. Hiding the cursor is certainly doable, but again I don’t know of any applications where you’d want to do this (and also use Cursor Lock) and I’m sure there are tools to do this already.
From my brief inspection, Splashtop doesn’t seem to be a unique bit of software. Lots of companies are working on remote access tools and specifically ones for gaming. I’d suggest that your problems need to be addressed by the remote access application.
Hi! I’m on windows 7, playing Quest for Glory 2 VGA remake, 640×480 window mode, using User Mode with locking Window Interior.
When I’m on the farthest edge, the regular window cursor appears it doesn’t register clicks inside the game. I made an animated gif recording of this:
https://gyazo.com/2e0000848888873d35648fb91b2b7cc9
Hm that’s strange. The screen capture shows the mouse all the way out of the window interior, but it’s really not. When I’m not recording it, the mouse cursor is inside the border.
Anyway, yeah, it’s not registering clicks when I’m on the farthest edge. Is there any way to fix it? Thanks
Interesting. It looks like it might be due to the Windows theme that the program is using, such that Windows thinks the game window dimensions are different than the game thinks they are. And since the “window interior” region is based on what Windows is reporting, that might cause your problem. You might try fiddling with compatibility settings for the program. Otherwise, I’m not sure how you might further explore what the problem is except with a developer tool like Spy++.
So I installed this for trying something with Baldur’s Gate Enhanced Edition on Windows 10. Tested what I needed to, and then tried to uninstall. It wasn’t listed as an Application in the windows 10 Program’s list, so I searched here an saw it mentioned to manually delete the program.
Unfortunately, Windows 10 didn’t like that. I now have a blank listing in my Start -> All Apps, and when I open the file location, it just goes no where. Kind of annoying, so I tried ccleaner to just delete the extension. Nope.
Any thoughts on how I can fix this, because this is going to give me Windows 10 PTSD.
The start menu is just a special directory. In Windows 10, it should be located at %ProgramData%\Microsoft\Windows\Start Menu\Programs. Failing that, you might just need to refresh the start menu somehow. Had a zombie shortcut on my start menu recently, and that one did have an uninstaller.
C:\Users\computer name\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
That’s where it’s located.
Confirmed working for Star wars The Old Republic. Thank you so much for this. It’s awesome. Working as intended and makes gaming SO MUCH EASIER!
It works for the launcher, but currently trying to figure out how to get it to work for the actual game.
To get it to work with SWTOR just use User mode and enable it while in game :3 easy-peasy.
Hello. What would I do if I wanted to lock onto a window that was forced into window mode through adding -win to the target?
All you have to do is use lock region of window interior. If you need to know more, read the manual.
I’ve done so, and it doesn’t detail what to do if you forced it into windows mode. I’ve tried to do what you said for Warcraft 3 below (Adding -window to args), tried targetting the original file and shortcuts, but whenever I open the cursorlock shortcut it is resumes back to fullscreen.
Another problem is when I target another game I get the error “unable to init draw”. I’m guessing this is game side and it’s just not compatible with Cursorlock, but worth an ask anyways.
Urgh, ignore the top one…I went back and realized there’s a checkbox next to args. I’m an idiot. Unable to init draw still stands though.
AFAIK, Cursor Lock has no incompatibilities with any other programs. It works on a level that games don’t even know it’s there. I would guess it has more to do with Warcraft 3. I fact, I remember having problems myself when I tried to play it on Windows 7 recently, so maybe google a bit on it.
Hello, first of all I would like to thank the developers of this software! However, I have noticed a slight nuisance that I believe is not working correctly on my Windows 8.1 machine. I am trying to create a “user strict” mode in which TAB is used to lock/unlock the screen and ESC is used to stop the program so that TAB will no longer act exclusively as the screen lock. TAB works fine, but I am noticing that ESC is not killing the process, is this what the “Close lock program/unlock hotkey” checkbox is supposed to complete?
I’m surprised that Tab alone can be used as a hotkey. I wouldn’t recommend using either tab or esc as hotkeys as they can often interfere with existing program functions. You should always use a modifier key like shift, ctrl, alt, or win when specifying hotkeys for Cursor Lock.
Need something to lock my cursor for Fallout: New Vegas. This app worked once before, but now will not lock the cursor to the game window, either with a program shortcut or with “user mode strict”. With the latter, it will work for other program windows, but not with the game.
Well, I have Fallout NV, so I can confirm that Cursor Lock works with it. Make sure FalloutNV.exe is set as the lock program. If you still can’t get it to work, consult the log file.
I’ve been successful with the software working for most of my games, but I’m confused on how to get this to work with Minecraft. Is it possible?