From Skyrim Nexus Latest Files

~~ Mouse Lock ~~

Introduction ~ If you’re like me, and you constantly have other windows open on your other monitors, you probably experienced a phenomena at some point where if you scroll your mouse in game, it can scroll down a window on a completely separate monitor. This is due to the fact that Skyrim does not actually lock the cursor while you’re playing, instead the cursor is actually just invisibly moving around in the background, which means your cursor can also wander onto other monitors and perform inputs that were never intended.

To solve this pet peeve of mine, I wrote a small C++ program that essentially just locks your cursor to the center of your main monitor upon pressing a key. This works universally, so if there are any other games that don’t lock the cursor, this program will work on them as well, since it’s not really program specific.

Instructions ~

To use it, simply run the program in the main file, and press Numpad * in order to toggle it. Sometimes, it may not register correctly, so if it fails to toggle, just try again. The program will make a sound when it toggles on and off. The reason for this is because I didn’t want to make the program that resource intensive, and making the keyboard input more precise means decreasing the delay between checks, which increases CPU usage. If you want to manually tweak these settings, see below.

Configuration ~

I also added the ability to tweak some of the settings through command line arguments. Simply launch the program through the command line and supply arguments specifying what you would like to change. Here is a list of all of the valid options you can specify.

This sets the key used to toggle the mouse locking. You can see a list of virtual key codes here.

vkid=0x6B (Default: 0x6A)

This will manually change the resolution that the program uses to determine the center of your monitor. It will already try to guess your monitor’s resolution automatically, and then divide the two heights to get the center. If for any reason, it is having some troubles

width=1920 (Default: Automatic)


This turns on a debug mode which will list some verbose information about the current state of the program. This will use up another thread to fetch the info, so unless you’re troubleshooting, I’d suggest keeping it disabled to save that extra little bit of performance 🙂

debug=1 (Default: 0)

These three are for managing the sound that is made when you toggle it on and off. The first is to disable it, the second is to set the frequency of the sound, and the third is to set the duration (in milliseconds)

sound=0 (Default: 1)

sound_freq=1000 (Default: 1000)

sound_dur=100 (Default: 10)

This is to set the delay between checks of the toggle key. The lower it is, the more accurately it registers but it may cause a determent to performance.

interval=100 (Default: 30)

Source Code ~

If you’re interested in the source code and want to see it for yourself, you can find it here and here[/size].

It’s made in Visual C++ and compiled in Visual Studio. If you want the Visual Studio solution, see the download section.

Original URL:

Leave a Reply