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.
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.
02-18-2014 11:21 PM
Hello,
I'm wondering if anyone could help modify the following example: http://www.ni.com/example/27650/en/. Currently, it sets different screen parameters (ie: resolution, pixel depth and refresh rate) for a default screen. I'd like to use it with two monitors. I found the function calls needed to do this; unfortunately, I'm unable to piece it together due to lack of function prototype translation knowhow.
You'll quickly notice that the first CLF would change from EnumDisplaySettingsA to EnumDisplaySettingsExA (http://msdn.microsoft.com/en-us/library/dd162612(v=vs.85).aspx).
The second CLF changes from ChangeDisplaySettingsA to ChangeDisplaySettingsExA (http://msdn.microsoft.com/en-us/library/dd183413(v=vs.85).aspx). The key implementation I'm after is the C++ example code shown almost at the bottom of this MSDN page - it first enters the desired resolutions for both monitors and then sets both simultaneously.
Any help anyone can offer is greatly appreciated. The final example, of course, can be made available for the community to benefit from.
Jorge
02-20-2014 11:02 AM
Jorgein,
I am resarching this issue, but unfortunately the "right" way to do it has changed a fair bit since this example code was created. It is possible to brute force it by calling the .dll directly (as this example does) but a better course of action is calling it through .net. I will update you as I make progress.
Thanks
02-20-2014 11:26 AM
That sounds awesome !!
I thought about going w .NET also but again I could use "higher" level assistance.
Looking forward to what you come up with !
Thanks !
Jorge
02-26-2014 10:20 AM
Just wanted to let you know I'm still working on this. I have a functioning vi, but would like to do it the "right way" before releasing it.
02-26-2014 11:59 AM
Thanks a lot Chris !
I appreciate your help and look forward to playing with the VI.
Jorge
03-04-2014 10:47 AM
Well, unfortunately this isn't as simple as it seems.
If your example code works properly, all you should need to do is reference system.windows.forms.screen in .net. Using property nodes you can get all screens, then use the device name property within a for-loop to come up with an array of the actual device names.
Then you just need to feed those device names in to the example code, but encased in a for-loop so that they displays are accessed individually.
Unfortunately, I'm currently getting a complete crash when I do this. I think it's due to a problem with changes in the EnumDisplaySetttingsA function since this code was originally written (which was quite some time ago).
Either way, this is not a recommended procedure for most situations. I would recommend consulting the MSDN documentation you referenced and pursuing this further if it's something that you really need to do.
03-04-2014 12:13 PM
Thank you so much for the effort to get this to work Christopher. I can take a stab at it; specially with your input on what .NET assemblies to use. The MSDN docs are helpful too.
Once more, thank you !
If I get this to work I'll respond to this thread with the code.
Jorge