LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Compatibility problem with CVI 7 and 8 programs

We have a CVI 7 program that, for test purposes, needs to verify the color depth of the monitor that it runs on.  It uses the following code:
 
int MonitorID = 0;
int ColorDepth = 0;
GetSystemAttribute (ATTR_PRIMARY_MONITOR, &MonitorID);
GetMonitorAttribute (MonitorID, ATTR_COLOR_DEPTH, &ColorDepth);
if (ColorDepth != 32)
{
   if (!ConfirmPopup("Color Depth Mismatch", "Invalid color depth, Do you wish to continue?"))
       return -1;
}
We've installed this program on multiple computers and it works as expected.
 
Some of us have recently upgraded to CVI 8.  When we install any CVI 8 program on a computer that also contains the CVI 7 application mentioned above, that application begins reporting that the color depth is incorrect.  Based on a quick test on one machine, the color depth returned by GetMonitorAttribute is now 0 instead of 32.
 
Apparently the CVI 8 installation is affecting the CVI 7 run-time engine in some way that causes the color depth to be incorrect.

Message Edited by Tony Gray on 11-30-2006 10:36 AM

0 Kudos
Message 1 of 7
(4,368 Views)
Hey Tony,
 
First of all, is it just the 8.0 runtime engine that you are installing, or the entire CVI 8 development environment? 
 
Secondly, does the function work correctly on the development computer?  Is the CVI 8 runtime engine installed on the development computer?  Ensure that you set it to release mode on the development computer to test to see if it works.
 
Finally, what if you create a simple application that simply has that one function call to GetMonitorAttribute?  I will try and set up a test system here with CVI 7 to try it out as well.
Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 2 of 7
(4,325 Views)
Andy & Tony,

We've confirmed that this is a bug that was introduced in CVI 8.0. We will have a fix for it in the next release of CVI. Unfortunately, the only workaround I can think of it to obtain the color depth using the Windows SDK directly in your program. Something like this:

depth = GetDeviceCaps(monitorDC, PLANES) * GetDeviceCaps(monitorDC, BITSPIXEL);

monitorDC is a device context for your monitor. You will receive it in the enumeration proc when you call the EnumDisplayMonitors function.

Sorry about the inconvenience.

Luis
0 Kudos
Message 3 of 7
(4,318 Views)

Thanks for the update.  Is it fixed in 8.1?

Tony

0 Kudos
Message 4 of 7
(4,293 Views)
No, not in 8.1, since 8.1 was wrapped up about a month ago, and we only now found out about this problem now. It will be fixed in an 8.1.1 maintenance release.

Luis
0 Kudos
Message 5 of 7
(4,283 Views)
I have the same problem with CVI 7.1.
 
Is there a workaround too?
I cant find the function 'EnumDisplayMonitors'.
Can you post the code?
 
Thanks.
Grüsse aus Deutschland

(GMT +01:00)
0 Kudos
Message 6 of 7
(4,077 Views)
Hello Dubin,

Although the ATTR_COLOR_DEPTH bug really should not have existed in CVI 7.1 (I tried it again now in 7.1.1, and I couldn't reproduce it), that's not important. I'm attaching some code, like you requested, that does the same thing using the Windows SDK. Basically if expands on the code snippet I had posted earlier.

To answer your question, EnumDisplayMonitors is a Windows SDK function. To use it you must include "windows.h" in your program. This particular function is only defined for Windows 2000 or later, so the code that I'm including has to redefine WINVER to be 0x0500. You can ignore the compiler warnings that come up as a result of that.

Let me know if you have any questions using this code.

Luis

Message Edited by LuisG on 08-16-2007 11:42 AM

Message 7 of 7
(4,055 Views)