Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically duplicating the desktop on Windows 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?

like image 647
phaz Avatar asked May 01 '16 12:05

phaz


1 Answers

SetDisplayConfig and DISPLAYCONFIG_TOPOLOGY_CLONE

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

like image 180
gordy Avatar answered Sep 27 '22 19:09

gordy