Post Reply

Forums -> Multiple monitors -> Enable secondary monitor on Vista
Guillaume   2009-07-05 08:58
I would like to know how I can enable my secondary monitor programmatically under Windows Vista.
What I currently do is:
EnumDisplayDevices(null, (uint)id, ref d, (uint)0); ... EnumDisplaySettings(d.DeviceName, -2, ref mode0); ... DEVMODE dm = mode0;dm.dmPosition.x = 1440; dm.dmFields = DM_POSITION; long result = ChangeDisplaySettingsEx(d.DeviceName, ref dm, IntPtr.Zero, CDS_NORESET| CDS_UPDATEREGISTRY, IntPtr.Zero); result = ChangeDisplaySettingsEx(null, ref dm, IntPtr.Zero, CDS_UPDATEREGISTRY, IntPtr.Zero);
But it doesn't work. I get 0 for the first ChangeDisplaySettingsEx and -1 for the second one.
Could you help me ?
What did I do wrong ?

Thank you,
Guillaume.
Forums -> Multiple monitors -> Enable secondary monitor on Vista

Post Reply