Sometimes it doesn't work.
This is my setup:

I don't know what else to tell you. Appreciate the effort, though.
What do you mean by "sometimes"? In some games (it works in some games but not others)? Or does it sometimes work in some game and sometimes doesn't work in the same game?
I only tested it with CS:GO, and sometimes when I was playing and I moved the mouse fast to the right the game minimized. Sorry if that was unclear.
Another thing I can tell you is that my mouse is set to 5000 dpi when playing. Don't know if that makes a difference or not.
Simple way to test if it's working: open a menu or any part of the game's interface where a mouse cursor is visible. If you can't move the mouse cursor to your other monitor, then it is working.
If the game minimized, then it is likely to be due to something else: a mouse gesture interpreted by another program, clicking on an overlay, clicking on an always-on-top window that wasn't visible because it was under the 3D overlay, or it could be a coincidence and the minimization was not due to mouse input (e.g. due to another program's window requesting focus).
I did try that and the program does work. However sometimes when I moved the mouse to the right it minimized. I really don't know what else it could be, but I will test it further today, and maybe make a video of it or something.
However sometimes when I flicked really fast to the right it minimized. I really don't know what else it could be, but I will test it further today, and maybe make a video of it or something.
A video probably wouldn't help. Here is some things you could try to fix or narrow down the problem:
-
Make sure you are using the right version of this program, as downloaded from here. There may be other programs with similar names and functionality, so be aware of possible confusion.
-
Make sure you aren't using any other similar programs while AutoMouseLock is running. This includes macro programs like AutoHotKey, as well as any complementary software that may have been bundled with with your mouse or keyboard, or their drivers.
-
Try closing other programs running in the background or system tray. That applies to all programs which aren't strictly needed to run the game and AutoMouseLock.
-
Check the game's settings. It should use the same resolution as your desktop resolution (which should be the same as the monitor's native resolution for LCD screens), and use either exclusive full-screen or windowed full-screen (a.k.a. borderless windowed) mode.
-
It could be an issue specific to the game or game engine. Check if you can reproduce the problem in another game, especially one using a different engine.
-
Finally, it would be worth trying to reproduce it with another mouse, if possible.
A video probably wouldn't help.
Why not? I mean a video taken with a video camera, not a game capture.
Why not? I mean a video taken with a video camera, not a game capture.
Because I think you described what the problem looks like well enough, and I don't think it would provide any more information than your description. You're welcome to record one, of course, but trying things from the list I posted above would probably provide more information.
Ok, I'll try my best to provide more information.
I wasn't able to replicate it on camera, but it happened twice while I was playing. No other application was requesting focus when the game minimized.
The problem is probably related to the automatic activation function (the fact that it has to detect a fullscreen application in order to run). You should make a version without that function and I will test it and report back.
Can you compile a debug version? It will print activations and deactivations to a window, which you can place on another monitor and see what it's doing.
Sorry, but I can't. I'm not a programmer and have no experience in that field.
OK, here is a debug build:
https://dump.thecybershadow.net/04f14fa7d7be5be9dd1e79ae2bb70eee/AutoMouseLock-signed.exe
You can ignore the lines with just numbers; look for the lines with the words "Locking", "Unlocking", "Success" and "Failure". If you see anything suspicious, make a screenshot.
This is what it looks like after it minimizes:

One more:

Hmm, first screenshot looks a little suspicious, looks like something stole focus or you clicked on an invisible window? Have you tried closing other programs yet?
Here's a debug build that shows more information, see if you can get it to happen again like the first screenshot:
https://dump.thecybershadow.net/a41ad1e409e779f54ba98e5a2c8b7039/AutoMouseLock-signed.exe
New build:

The first screenshot was your application requesting focus, the second one is the Windows desktop itself. So like I mentioned, there is a problem with the automatic function. A version without it would be better.
The first screenshot was your application requesting focus
What do you mean? Did you run it a second time? You should terminate past instances before running a new one.
the second one is the Windows desktop itself.
Yes, nothing suspicious there. Looks like the game minimized and the desktop became focused. Still no clue as to what caused it.
What do you mean? Did you run it a second time? You should terminate past instances before running a new one.
I was running it on the second monitor, and when it minimized it became the focus instead of the desktop. And that was the window size of it (640,1020).
OK. The program definitely does nothing to request focus to its console window, so it was likely the OS giving focus to the next window in the Z-order. The non-debug version does not create any windows at all.
See my comment above.
The focus on it was simply activated by a mouse click, as a result of the program no longer working to restrict mouse movement.
Oh, that's clears things up a bit. It means something is undoing AutoMouseLock's work and resetting the mouse clipping rectangle. Could be either the game itself or another program running in the background.
I guess so, but if having to close other programs is required then this is not something I would use - it's not worth it only for the automatic function. I think you should have a version with it and a version without it. Just my 2 cents.
That's misrepresenting the situation.
As it is, likely one of the following two is true:
-
The game or a program that is running already has a feature to confine the mouse cursor to the game's monitor - in which case, you don't need AutoMouseLock, you just need to find the corresponding game/program option and change it from "don't confine" to "confine".
-
The game or a program that is already running is misbehaving, in which case it is a bug in that software which should be reported to that software's vendor.
I asked to try running it after closing other programs or with other games to narrow down which one is causing this behaviour. As it is, you haven't provided me with a lot of information to go on, so I can only make guesses from the information that you've provided me so far. Which is why you need to do some of the tests in my comment above to find the real culprit.
Another debug build, which prints the current lock rectangle in addition to the other information: https://dump.thecybershadow.net/ce88964db0c590fb0529d4dc2ef05458/AutoMouseLock-signed.exe
You should be able to see the moment it changes to no longer be confined to the game window, which might be in reaction of some event.
The cursor was already unlocked at the top of your screenshot. See what causes the last 2 numbers to change from (1920,1080) to (3840,1080).
Yes, I deleted it. I'll try to see what causes it, but my second monitor is not a physical monitor, it's just another input to the same monitor.
Ah, OK. I could add a sound to when it changes if that would help.
Yes, that would help a lot.
OK, I think this should work, it should start beeping when the cursor clipping rectangle isn't as it should be: https://dump.thecybershadow.net/b056d7f497edceea4e9bb767bc6c6704/AutoMouseLock-signed.exe
It's still difficult to see, because if I want to scroll up to see the debug log it locks the mouse, but I'm trying. I did hear the sound when a mismatch was detected, so that's good.
Ok, I was able to see it this time. cmd.exe causes it.

Makes sense. But it's like I said, if this requires the closing of other programs then I have no use for it.
You have cmd.exe running in the background?
cmd is just a command interpreter, it should do nothing on its own. Do you know what starts it?
I do. It's my miner.
That said, that's not the only program that I'm interested in running while I play, so yeah...
Don't get me wrong, I know that other programs might not cause this issue, but I'm just saying.
For me a version without the automatic function would be ideal. Or without the unlock function, rather.
Well, I don't know what "miner" means in that context, but if it's really the culprit then it's almost surely doing something that it shouldn't be doing. Working around bugs in other software is not really AutoMouseLock's goal, so I agree that there is not much that can be done from AutoMouseLock's side.
For me a version without the automatic function would be ideal.
That would have no effect - whatever is causing the problem is undoing AutoMouseLock's work. The only thing AutoMouseLock could do is periodically check whether something has undone its work and reset the cursor clipping rectangle, however that would not be a foolproof solution (it would be inefficient, and it would have to occur on a timer, so the mouse could still have moved outside the game window between the points in time when the misbehaving program clears the clipping rectangle and AutoMouseLock reinstates it).
That said, that's not the only program that I'm interested in running while I play, so yeah...
At the risk of repeating myself, I want to again clarify that my suggestion of closing other programs was not meant as an advice for a final solution, but to narrow down the problem so that a better solution could be found with the gathered information. Though, if you're confident that you found which program is misbehaving, and you want to keep using it despite your knowledge that it's misbehaving, that is now moot.
Ok, I understand. Thanks for the effort, anyway. I like programs like this: simple and to the point. That's what attracted me to it in the first place.
Now I'm confused:

Seems CS:GO itself is causing the unlock now?
On the other hand, I confirmed that cmd.exe wasn't my miner. It was a warning I had setup that I thought I had turned off. Now cmd.exe doesn't pop up anymore.
The only thing AutoMouseLock could do is periodically check whether something has undone its work and reset the cursor clipping rectangle, however that would not be a foolproof solution (it would be inefficient, and it would have to occur on a timer, so the mouse could still have moved outside the game window between the points in time when the misbehaving program clears the clipping rectangle and AutoMouseLock reinstates it).
I don't like this solution, but here is a (non-debug) build which implements it. It should probably work fine for you. Hopefully that will override the misbehaving program's behaviour.
I could write a program which would hook all calls to the relevant Windows API function to find which exact process is causing the problem, but it would take some time, and I understood that you weren't interested in finding the root cause anyway.
Excellent, I'll give it a go.
So far so good. I can't expect that it will work 100% of the time (because of your explanation), but it's a lot better than nothing, and better than the original version for me.