05-09-2012 03:57 PM
I'm using LabWindows/CVI 10.0.1 on a 64-bit Windows 7 Ultimate system with four monitors. During a certain test one of the computer's video outputs is disconnected from its display monitor and connected to the input of a video capture card. Once the video output is reconnected, Windows sees it once again as a display monitor.
My application uses GetSystemAttribute (ATTR_FIRST_MONITOR, ...) and then GetMonitorAttribute (..., ATTR_NEXT_MONITOR, ...) to enumerate the monitors in the system. It does this again after the video connections were changed, but the monitor that was changed now had apparently random X/Y coordinates.
As a test, I tried changing the monitor enumeration code to use the Windows API method by calling EnumDisplayMonitors and providing a callback MonitorEnumProc. This fixes the problem; it recognizes the re-connected monitor with valid X/Y coordinates.
I had tried the LabWindows/CVI sample Multimonitor program, which appeared to be correct at first, but then I realized it was only reading the monitor configuration once. When I switched over the monitor as I had during my application, the sample program gave correct monitor information, but only because it had never updated the information since the application started.
I have no problem using the Windows API method, but it seems like Windows is recognizing a change of monitors and this change is not getting properly passed on to the LabWindows/CVI monitor enumeration functions, so I thought someone would want to know about this.
Brian
05-10-2012 10:22 AM
Hi Brian,
I am glad you were able to find a way around the problem by using the Windows API functions. Thank you for making us aware of this. I will do some further investigation to verify that this is an issue so it can be corrected.