I'm working on a legacy vb6 application that operates on Windows XP (embedded) that uses ChangeDisplaySettingsEx to control the resolution of the connected monitors.
I have been tasked with finding a way to get ChangeDisplaySettingsEx to change between Clone and Extended mode when more than one monitor is installed.
When a second monitor is connected it automatically works in Clone mode.
When I enumerate the available display devices using EnumDisplayDevices, the DISPLAY_DEVICE.DeviceString appear as follows:
\\.\DISPLAY1\Monitor0
\\.\DISPLAY1\Monitor1
When the Monitors are in Extended mode, they appear as follows:
\\.\DISPLAY1\Monitor0
\\.\DISPLAY2\Monitor0
I've read MSDN repeatedly and there doesn't appear to be a solid answer tas to how you invoke the APIs to change the mode from Clone to Extended.
My guess was to detach the second monitor and then try and figure out a way to reattach, so I started trying to detach as per http://msdn.microsoft.com/en-us/library/dd162617(v=vs.85).aspx but I can't get any of this to work.
Whenever I try parsing \.\DISPLAY1\Monitor1 to ChangeDisplaySettingsEx I get DISP_CHANGE_BADPARAM - e.g.
ChangeDisplaySettingsEx(\\.\DISPLAY1\Monitor1, DevM, 0, CDS_GLOBAL Or CDS_UPDATEREGISTRY, 0)
I'm really pulling my hair out with this.
Does anyone know how to disable Clone Mode and enable as Extended Mode using the APIs?