From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetMonitorAttribute Bug

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):

 

http://www.ni.com/product-documentation/14686/en/

 

Any ideas?

 

Thanks!

 

 

0 Kudos
Message 1 of 7
(4,741 Views)

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

0 Kudos
Message 2 of 7
(4,674 Views)

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.

0 Kudos
Message 3 of 7
(4,656 Views)

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

0 Kudos
Message 4 of 7
(4,628 Views)

Any luck with this?

0 Kudos
Message 5 of 7
(4,344 Views)

Has this problem been addressed? I am having the exact same issue on Labwindows/CVI 2013.

0 Kudos
Message 6 of 7
(2,797 Views)

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

www.ni.com/support

 

0 Kudos
Message 7 of 7
(2,781 Views)