I wanted to write one module in win32 which can detach all monitors and attach them back. It is working if no monitors are duplicated. But if two monitors are duplicated then two monitors are under same display eg Display3\Monitor0 and Display3\Monitor1. Detach using ChangeDisplaySettingsEx succeeds but reattach using same API and stored DEVMODE reattaches only one monitor to Display3 and the other monitor just remain disconnected.
And ChangeDisplaySettingsEx failes if i give full monitor name(eg Display3\Monitor0). It just works for first argument being just DisplayName ( eg Display3).
So someone please guide me how can i re-attach both monitors to Display3 as there were before detaching.