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.