09-22-2009 02:05 PM
How can I query the system to findout the desktop dimensions of the screen the program is running on?
I need to popup a borderless fullscreen window, up to now I've had control of the hardware so I know the screen resolution (1920x1200) but there is interest in making the system "just an application" so I'd have to deal appropriately with different (likely smaller) maximum pixel resolutions.
This window is basically a tile of canvas controls created programatically so the only real issue is getting the screen size at run time and creating the tiles or printing an error message if the screen is too small to use (i.e. 800x600)
--wally.
Solved! Go to Solution.
09-22-2009 02:15 PM
09-22-2009 02:21 PM
Thanks this is the answer I was looking for. The CVI help index came up empty when I typed screen or desktop, I should have been clever enough to put a "get" in front of them 😞
Any experience with this function behavior in a multi-monitor setup? The CVI help for it is pretty sparse.
Thanks!
--wally.
09-22-2009 02:36 PM
Quick test on my development system (three 1280x1024 displays) suggests GetScreenSize() is oblivious to multi-monitor setups since it returned h=1024, w=1280.
Is there any CVI support for trying to figure out the configuration of a multi-monitor setup at run time? Obviously this can be pretty complicated, expecially if all displays are not the same size or in a line.
--wally.
09-22-2009 02:56 PM
Hi wally,
I have no actual experience on multi-monitor environment, but I have found this thread that can give you some sources where to find the informations that you need.
09-22-2009 03:13 PM
Thanks, I'd just found it using the search funtion. GetMonitorAttribute() seems to be the way, but the key will be how clear the documentation for the various monitor attributes is.
--wally.
09-22-2009 03:59 PM - edited 09-22-2009 04:01 PM
Hey Wally -
You could also try the following bit of code using the Win32 API. I think it should get you what you need.
See the documentation for some of this here and here.
NickB
National Instruments
09-22-2009 04:56 PM
int i, w[9]={0},h[9]={0}, Nmonitors, primary, first, monitor[10]={0}, top[9]={0},left[9]={0}; GetSystemAttribute (ATTR_NUM_MONITORS, &Nmonitors); GetSystemAttribute (ATTR_PRIMARY_MONITOR, &primary); GetSystemAttribute (ATTR_FIRST_MONITOR, &first); monitor[0]=first; for(i=0;i<Nmonitors;i++){ GetMonitorAttribute(monitor[i], ATTR_NEXT_MONITOR, &monitor[i+1]); GetMonitorAttribute(monitor[i], ATTR_HEIGHT, &h[i]); GetMonitorAttribute(monitor[i], ATTR_WIDTH, &w[i]); GetMonitorAttribute(monitor[i], ATTR_TOP, &top[i]); GetMonitorAttribute(monitor[i], ATTR_LEFT, &left[i]); }
Thanks, the code snippet above seems to get all the info I require using only CVI calls. I usually mix CVI and Win32 calls anyways, but this saves having to dig up the documentation on the Win32 structure typedefs.
Thanks for the Win32 multi-monitor documentation links.
--wally.
09-23-2009 05:20 AM - edited 09-23-2009 05:23 AM
Hi wally,
The "solution" to your question is what Nick provided, not your final post.
For the sake of healthy forum statistics mark the "answer" that solves your problem, not your own messages.
Take care, 😉
09-23-2009 07:31 AM
Since this is a CVI forum I consider the pure CVI solution the most appropiate. All the posts above quickly focused my search on the proper terms to find out the needed function names and their usage and was the help I needed.
I was planning to mark two solutions but the option when away after I clicked the first one.
--wally.