When I right-click the desktop and then select "Display settings" (Windows 10), a configuration window opens where I can select how to handle a system with two or more monitors. There I can select "Duplicate these displays" (both monitors show the same) and "Extend these displays" (both monitors show different contents, the desktop is extended to the complete size).
Now I want to do that programmatically, means I need to switch and persist this mode out of my application. How can this be done? Are there some system function calls, is it possible via the registry or via some configuration application to be called with specific command line parameters? Any idea how this possible?
Thanks :-)
Thanks to @DrakeWu it is working now:
SetDisplayConfig(0, NULL, 0, NULL, (SDC_APPLY | SDC_TOPOLOGY_CLONE));
Important note: the MS-documentation describes the mode is changed for "the current session" (which for my understanding means as long as my application is running), which is nonsense. The display config is kept also when the application ends and even when the system is rebooted.