10

I've been looking into ways to programmatically manage my monitors using C++.

It looks like functions like EnumDisplayDevices, EnumDisplaySettings and ChangeDisplaySettings can be used to, e.g., change the resolution of individual display devices and attaching/detaching said devices to/from the desktop.

In addition to these operations, I want to be able to duplicate my desktop to multiple monitors.

A concrete example would be to go from this setup where the desktop spans two devices...

enter image description here

...to this setup, where the desktop is instead duplicated to said devices.

enter image description here

I have tried investigating the APIs on MSDN, and looking for similar questions, but cannot seem to find any indication as to whether or not this is possible to do.

Is it possible to use C++ to duplicate my desktop to multiple display devices, and if so, how? If not, is it then possible to do it some other way, e.g. using another programming language, or am I forced to use options like the Windows Control Panel to change such settings?

Barmak Shemirani
  • 30,904
  • 6
  • 40
  • 77
phaz
  • 872
  • 9
  • 23
  • 4
    FWIW, I don't see why this question is so poorly received. It asks a very concrete narrow question rather clearly and shows enough investigation on your part that I would have asked on here too if I had had the same problem. –  May 01 '16 at 12:35
  • I've tried to narrow down the question to C++, and clarify exactly what I'm trying to accomplish. If this still ain't good enough, please let me know what is missing... :-/ – phaz May 01 '16 at 12:57
  • 1
    This is a good question with proper examples and situations. Why the downvotes? – TechnicalTophat May 01 '16 at 15:26
  • Apparently the question wasn't that good in its initial form. It doesn't look like improving it makes any difference now, though. :-/ – phaz May 05 '16 at 03:09

1 Answers1

3

SetDisplayConfig and DISPLAYCONFIG_TOPOLOGY_CLONE

Here's a PAQ w/code using this function to switch to extended mode.

Community
  • 1
  • 1
gordy
  • 9,360
  • 1
  • 31
  • 43
  • Could you perhaps elaborate with a bit more than just two links? How would you use this function and enumeration to duplicate a desktop? – phaz May 08 '16 at 08:08
  • 1
    @Phazyck [here's a previously asked question with code showing how to use this method](http://stackoverflow.com/a/6619994/99691). – gordy May 09 '16 at 01:49