According to CCD example pseudocode and part of the answer, you need to find out the path from the current primary(adapterId A) to targets(adapterId B). To find out the path, the previous mentioned answer tries to enable each source+target pair that contains the target(adapterId B) until one works.
Relationship of Mode Information to Path Information has a picture for explanation.
Finally, It‘s important to check whether all your monitors(adapterId A &B) are available in the Display setting or not.
Programmatically - Cross-adapter Clone with NVIDIA and Intel
I have been using this script to optionally clone/duplicate and two displays, but this fails when doing cross adaptor cloning, for example "cloning main display (Intel adapter) to external display (Nvidia adapter)"
- include <iostream>
- include <windows.h>
- include <vector>
-
- int main()
- {
- UINT32 pathSize;
- UINT32 modeSize;
- GetDisplayConfigBufferSizes(QDC_ALL_PATHS, &pathSize, &modeSize);
-
- std::vector<DISPLAYCONFIG_PATH_INFO> pathArray(pathSize);
- std::vector<DISPLAYCONFIG_MODE_INFO> modeArray(modeSize);
- QueryDisplayConfig(QDC_ALL_PATHS, &pathSize, &pathArray[0], &modeSize, &modeArray[0], NULL);
- pathArray[1].sourceInfo.id = pathArray[0].sourceInfo.id;
- pathArray[1].sourceInfo.modeInfoIdx = pathArray[0].sourceInfo.modeInfoIdx;
- UINT8 flags = SDC_APPLY | SDC_SAVE_TO_DATABASE | SDC_ALLOW_CHANGES | SDC_USE_SUPPLIED_DISPLAY_CONFIG;
- SetDisplayConfig(static_cast<UINT32>(pathArray.size()), &pathArray[0], static_cast<UINT32>(modeArray.size()), &modeArray[0], flags);
- return 0;
- }
when I use :
SetDisplayConfig(0, NULL, 0, NULL, SDC_TOPOLOGY_CLONE | SDC_APPLY);
that works, but this calls the last configuration in the database but does not allow me to select displays optionally.
could you please help me with that.
2 answers
Sort by: Most helpful
-
Xiaopo Yang - MSFT 12,726 Reputation points Microsoft Vendor
2022-04-27T08:20:34.743+00:00 -
Limitless Technology 39,781 Reputation points
2022-05-03T07:19:35.623+00:00 Hi there,
The issue could be related to Display drivers which are not allowing you to select displays optionally. Also try to enable clone mode and see if that changes the way the script functions., follow these steps to enable the clone mode.
- In desktop mode, right-click on the Desktop and select Graphics Properties.
- Click Display > Multiple Displays.
Under Select Display Mode, click Clone Displays; for old CUI, click the drop-down arrow for Operating Mode and select Clone Display.
Hope this resolves your Query!!
--If the reply is helpful, please Upvote and Accept it as an answer–