07-21-2015
01:29 PM
- last edited on
11-18-2024
11:57 AM
by
Content Cleaner
Hello All
I am having an issue with the GetMonitorAttribute function. I am using a dual monitor set up for a test station, and the second monitor will be unplugged and pluged back in quite often. The first go around the call to GetMonitorAttribute works fine. If I unplug the hdmi cable and plug it back in, the data retrived from the function is garbage. I am running LabWindows 2013 f1.
Apparently this was a bug in 2012 (See ID 397059):
https://www.ni.com/en/support/documentation/bugs/13/labwindows--cvi--2013-bug-fixes.html
Any ideas?
Thanks!
07-22-2015 11:23 AM
Hi bry0n,
The bug you pointed out is specifically for the GetMonitorFromPoint, GetMonitorFromRect, and GetMonitorFromPanel functions, so a bug in GetMonitorAttribute may not have been fixed. To report a bug we need steps and a small set of code to reproduce this issue. Could you post those here? We can take a look at it and determine if a new bug report needs to be filed.
Thanks,
Kevin Flanagan
Applications Engineer
National Instruments
07-23-2015 09:30 AM
Hi Kevin,
Thanks for the reply. I did not realize the bug I found was for those other functions.
Here is a snippet of code that I am using:
GetSystemAttribute (ATTR_PRIMARY_MONITOR, &primaryMonitorID); //Find Primary monitor GetSystemAttribute (ATTR_NUM_MONITORS, &numMonitors); //Get the number of monitors if(numMonitors > 1) //As long as there is more than one monitor { for(loop = 1; loop <= numMonitors; loop++) //Begin a loop through the monitors { GetMonitorAttribute(loop, ATTR_WIDTH, &width); //Get the monitor width GetMonitorAttribute(loop, ATTR_HEIGHT, &height); //Get the monitor height GetMonitorAttribute(loop, ATTR_LEFT, &posLeft); //Get the x origin (top left of screen) GetMonitorAttribute(loop, ATTR_TOP, &posTop); //Get the y origin (top left of screen) if( (numMonitors >= 1) && (width == 1280) && (height == 800) ) //Look for specific monitor size { SetPanelSize(panelLcdHandle, height, width); //Set the panel to fit monitor SetPanelPos(panelLcdHandle, posTop, posLeft); //Set panel onto screen break; } } }
The code works fine the first time through, but if the monitor is unplugged and plugged back in is when the issue arrises.
07-24-2015 02:08 PM
Thanks for the code, I'm going to attempt to reproduce this on my system and file a bug report if necessary.
Kevin Flanagan
Applications Engineer
National Instruments
09-24-2015 12:40 PM
Any luck with this?
02-28-2017 10:52 AM
Has this problem been addressed? I am having the exact same issue on Labwindows/CVI 2013.
03-01-2017
01:06 PM
- last edited on
11-18-2024
11:58 AM
by
Content Cleaner
Hi vicgd,
I am sorry that you are experiencing this issue. The LabWindows/CVI development team has run into some obstacles regarding this issue in software version 2013. The behavior has been fixed in CVI 2015.
Best Regards,
Mitchell Faltin
Applications Engineer
National Instruments