Jump to content

Get monitor number from mouse location


Ronin7

Recommended Posts

Posted (edited)

Good morning

I am trying to find a mechanism to determine which monitor a mouse is on (to determine which monitor to display a pop up). I can probably get calling VIs monitor but that is not exactly what I need.....

Any help is appreciated!

 

Edited by Ronin7
  • Ronin7 changed the title to Get monitor number from mouse location
Posted

There is an Application property called Display->All Monitors. It will give you the pixel ranges of the monitors in your system. What I've done is to use the calling VI's position to figure out which monitor it was on and then place the new VI window as needed. You could use a win32 dll call to get the mouse position as well if that better meets your requirements.

  • Thanks 1
Posted

I posted a demo set of VIs here which can pop up a window, centered on whatever monitor the mouse is on.  There's also settings to have the window center on the mouse wherever it is, but saying on the same monitor.  And yes this uses the All Screens, Working Area properties.

 

  • Thanks 1
Posted

@crossrulz@hooovahh

 

Thank you very much for the assistance- the VIs Hooovahh put together will be perfect for what I am trying to do.  Hooovahh- It looks like the center on mouse took a fair amount of fussing to get working so I appreciate you posting the code as it will save a lot of time.  I can tell you this much- NI should be paying you guys for figuring this stuff out which should be basic functionality for UI interaction......

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.