Jump to content

[Solved] Problem with MouseMoves on dual monitors


Recommended Posts

I have a script that attempts to issue a MouseMove to a predefined screen location whenever a "sub GUI" is closed (i.e., the script's main GUI can create another GUI as part of certain functions).

I use MouseCoordMode=0 and the MouseMove actions work fine when the sub GUI is kept on the primary monitor. However, if I drag the sub GUI to the second monitor (defined as "extended") and close the sub GUI, the MouseMove sometimes places the cursor to odd locations on the primary monitor (and never to any location on the second monitor, BTW). I can't find any references for using MouseMove with dual monitors that help me understand my result.

Does anyone know of a way to ensure that focus returns to the primary monitor before the MouseMove is issued? (BTW, the main GUI can be in a minimized state, so I can't use WinActivate). I realize this is a fringe case, so my expectations are fairly low. But this problem has been occurring for a couple of years and I'd like to have a handle on it.

Thanks in advance for any help.




Edited by qwert
Link to comment
Share on other sites

On 10/5/2019 at 11:00 AM, qwert said:

BTW, the main GUI can be in a minimized state, so I can't use WinActivate

Well, as it turns out, I have to use WinActivate. It has to occur before a MouseMove, whenever the MouseCoordMode is 0.  For some reason that I can't recall, I got the idea that the screen coordinates of my script's main GUI were somehow kept, even if the GUI wasn't actually displayed at the moment. My tests show that that isn't the case. Even GUI "show" and "enable" commands aren't enough. But a WinActivate works.

I've restructured my script a bit and will rely on the sequence that works. But for anyone reading this, I want to emphasize that I only had MouseMove problems after dragging GUIs to the extended desktop on a second monitor.

I'll consider this "solved".

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...