Stefan 2003-06-24 02:33
Hi all, I'm trying to switch the primary display programmatically using a Windows GDI function called ChangeDisplaySettingsEx. I'm setting dwflags to CDS_SET_PRIMARY and the function returns DISP_CHANGE_SUCCESSFUL, but obviously the primary display is still the same. At least in the display properties.
Has anybody ever tried to do this and has some advice or code snippet in C++ or VB?
Thx a lot! Stefan
|
ecarlson 2003-06-24 11:59
Is this a repeat? I thought someone asked the same question a few months ago.
- Eric www.InvisibleRobot.com
|
Stefan 2003-06-24 19:45
The question from the guy a few month ago was about creating a shortcut to launch the "Switch Primary.vbs" add-on, which is based on UltraMon.
I don't have UltraMon. And even if I had it, the "Switch Primary" script won't work for me since I have 3-5 monitors, but he script only works for 2.
I wonder how UltraMon does this? I found another tool at http://home.pacifier.com/~guygp/index.html?MonSwitch.html~main that is able to set monitor size, position and so on, but also fails to set the primary monitor. Obviously the same problem.
Stefan
|
Christian Studer 2003-06-25 01:01
The script is limited to two monitors because it sets either monitor 1 or 2 as primary.
To set any monitor as primary using UltraMon, you would use VB code like this:
Set sys = CreateObject("UltraMon.System") sys.Monitors("3").Primary = True sys.ApplyMonitorChanges
Christian Studer - www.realtimesoft.com
|
Stefan 2003-06-26 18:25
Thanks for explaining how it works with UltraMon.
However, this still does not tell me how to do it using the ChangeDisplaySettingsEx GDI function (to be honest, if I were the author of UltraMon I would probably also try to avoid telling people how one of it's features works ;-).
But I found another (independent) source that explains the trick with ChangeDisplaySettingsEx:
http://groups.google.com/groups?selm=%23y6h%24lwNDHA.2228%40tk2msftngp13.phx.gbl
Stefan
|