❔ Restricting mouse movement
Hi!,
I am trying to restrict mouse movement on the area of the whole screen. I am using SetWindowsHookEx for LowLevelMouseProc. For checking monitor area I am using GetMonitorInfo, and here is my problem. When all screens have the same dpi, everything is fine, if primary screen have scaling 125%, and screen where I want to restrict movement 100%, everything is fine but if primary has 100% and second has 125%, boundaries of the screen are wrong.
4 Replies
i think ur overcomplicating things and are looking for this?
https://learn.microsoft.com/en-us/windows/win32/learnwin32/other-mouse-operations#confining-the-cursor
Miscellaneous Mouse Operations - Win32 apps
The previous sections have discussed mouse clicks and mouse movement. Here are some other operations that can be performed with the mouse.
all these functions work with pixels and not dpi so you will have to find a solution for that later
It's not what I am looking for
I want to restrict a mouse movement on specified screen, but allow on others
I have working mouse movement restrictor, but I don't know how to get proper dpi aware coordinates of screen
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.