From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting position of a secondary monitor

Solved!
Go to solution

Is there a function that tells me whether my secondary monitor is to the left or right of the primary monitor?

 

I am drawing 2D objects on a vi which will be displayed either on the primary or secondary monitor to the left or right, and have used the FP.monitor bounds property to re-size the vi and find the origin. But this only gives me the total screen width - I can only tell if the workspace is one or two screen sizes long, not where they are. I have tried to work this out using the panel.bounds but this is a little messy.

 

Thanks  

0 Kudos
Message 1 of 5
(3,217 Views)
Solution
Accepted by topic author grahamwebb

Are you on Windows?

 

If so, you can use .NET to find out more information.  Here's an example to get you started:

 

allscreens.png

 

That first one is System.Windows.Forms.Screen and you can explore the other properties and such until you get the information you want.

Message 2 of 5
(3,200 Views)

Actually, it would really surprise me if even Windows can tell whether Monitor 1 is to the left or right of Monitor 2.  Here's a thought experiment -- take any dual-screen system with, say, a Desktop showing on the left Monitor and a picture showing on the right Monitor.  Now, pick up the two monitors and physically switch their positions, leaving them connected.  Don't you expect the images to move with the Monitors, regardless of which was Monitor 1 or Monitor 2?

 

Maybe I am misunderstanding what you are trying to do ...

 

Bob Schor

0 Kudos
Message 3 of 5
(3,182 Views)

When you set up multiple displays in the control panel, you tell them where they go for purposes of moving the mouse cursor between them seamlessly.  Sure, if you lie to Windows in the control panel, your monitors will read as being in the wrong places.  But as long as you set them up here honestly:

Monitor positions.PNG

Then you should be able to get their relative locations.

0 Kudos
Message 4 of 5
(3,175 Views)

Thanks Kyle. That's exactly what was I after. And I have just learnt to call Windows comands usign .NET 🙂

0 Kudos
Message 5 of 5
(3,148 Views)