I want to be able to enable my secondary monitor with C# in Windows Vista. Here is what I do:
SafeNativeMethods.EnumDisplayDevices(null, (uint)id, ref d, (uint)0);
...
SafeNativeMethods.EnumDisplaySettings(d.DeviceName, -2, ref mode0);
...
SafeNativeMethods.DEVMODE dm = mode0;
dm.dmPosition.x = 1440;
dm.dmFields = SafeNativeMethods.DM_POSITION;
long result = SafeNativeMethods.ChangeDisplaySettingsEx(d.DeviceName, ref dm, IntPtr.Zero, SafeNativeMethods.CDS_NORESET| SafeNativeMethods.CDS_UPDATEREGISTRY, IntPtr.Zero);
result = SafeNativeMethods.ChangeDisplaySettingsEx(null, ref dm, IntPtr.Zero, SafeNativeMethods.CDS_UPDATEREGISTRY, IntPtr.Zero);
This does not affect my secondary monitor even if I get 0 as result (which means SUCCESSFUL).
What have I done wrong ?
Thank you.