Showing results for 
Search instead for 
Did you mean: 

Multiple Screen/Monitor Application - Best Method



I have a two-monitor system where one screen has user controls and the other screen is showing a matlab figure.

The goal: if the VI is on screen '1', the figure will launch on screen '2', and the other way around. Meaning, the figure will launch in the opposite screen to the VI.


The problem: the system has to be generic PC-wise, i.e. different PC systems have different configurations for the extended desktop mode - some have screen '1' labeled as 'primary' while screen '2' is secondary, and their position can change too.


My plan: let LabView get the current screen configuration: where screen '1' is, where screen '2' is and then check if the controlling VI is on screen '1' or screen '2'. This information will let my matlab script launch the figure in the opposite coordinates (left = -1, or 0 or 1 - there are three options).


How can I get screen configuration info with LabView?



0 Kudos
Message 1 of 10

Create a property node with VI as the selected class.  Change the property to Front Panel -> Monitor.  This will return the monitor of the calling VI. 

LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 2 of 10

If the 2 monitors have different sizes, you can use the Property node Display->All monitors from the Application class (default when creating a property node) to get the size of all available monitors and figure out which one is which.

Marc Dubois
HaroTek LLC

0 Kudos
Message 3 of 10

In such case, one user might have monitor '1' configured as 'primary' and monitor '2' configured as 'secondary'. Another user might have a different configuration. This will make a mess in Matlab's figure position properties.

To make this as generic as possible, I need to know not only the monitor enumeration, but also their positions relative to each other - i.e. is monitor '1' on the left or on the right with respect to monitor '2' ? And which one is 'primary' ?

By "make this generic" I mean that I don't want the end-user to go to the graphics settings and adjust it according to my SW. I want my SW to adjust according to the end-user.





0 Kudos
Message 4 of 10

Additionally, at client site this happened:

Laptop screen defined in windows as screen '1' primary. 

External monitor as '2' secondary.


FP.monitor says laptop screen is '2' and external monitor as '1'. Opposite to windows setting.


What is going on?

0 Kudos
Message 5 of 10

I think one of the problems is that you have video drivers settings and you have Windows settings and they don't seem to play nice together.  It's not difficult at all to futz around with the desktop order and primary desktop settings to a point where the Identify button doesn't match with what's in the settings.  And then what does Labview look at to determine monitor 1?  Does it look at a Windows registry setting, does it call some DLL?  Suffice it to say that you are going to spend months trying to get this to work properly on your desktop, only to get it to you client and nothing works how you want it.  There are way too many scenarios to account for (and you'll always miss at least one of them).


I think the best solution is when you run the app for the first time, save the windows settings to an INI file.  All apps are like that when you first open them.  Outlook never looks like you want it during the first run but after you move some things around, it remembers your preferences.  I don't think that is out of the realm of expectation when it comes to software programming.  

LabVIEW 2017
LabVIEW Programming
Message 6 of 10

Case in point:

I set my right monitor to be my primary and ran the FP.Monitor on the left monitor.  As you can see, FP.monitor returns 1, even though the help file says that this property returns 1 for the primary monitor.  None of it makes sense, so it's really not worth the effort trying IMHO.


LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 7 of 10


Thanks for the reply and help.

I've also come to the conclusion that it will be quite a waste of time to try and make it absolutely generic and 'transparent' to the end-user.

Since my clients are not very tech savvy psychology researchers, I wanted to make their life easier.


I think that a possible way to go would be a little pre-configuration VI that will let the user define which monitor (laptop/operator or external/test-subject) is on the left and which one is on the right, this way I will know whether to open a figure on the left screen or on the right screen.

0 Kudos
Message 8 of 10

I hate to necro post... but in case anyone is looking for a solution.


To clear up some definitions:
Monitor number 1, 2, 3 ... n is enumerated in a fixed by windows and can be any arranged in any random order you desire. (2,1,3 or 3,2,1 ...)

Primary monitor is the one with the task bar.

Current monitor is the one the FP occupies (if split between screens, it select the monitor with the higher percentage of the FP)


 Hope this helps.

Monitor Test.png

(using Windows 7 & LV 2016)

Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
Message 9 of 10

can you save codes for labview2013?

0 Kudos
Message 10 of 10