Hello, @mcangny
In clone mode both cloned monitors has same adapterid. Is this information reliable?
Judging from the test results, the api only returns the adapterid of a single display. There is no document showing that you can judge whether the monitor is in clone mode from this information.
Is there any document regarding winapi display library regarding display modes and id explained?
The DISPLAYCONFIG_TOPOLOGY_ID enumeration specifies the type of display topology.
typedef enum DISPLAYCONFIG_TOPOLOGY_ID {
DISPLAYCONFIG_TOPOLOGY_INTERNAL,
DISPLAYCONFIG_TOPOLOGY_CLONE,
DISPLAYCONFIG_TOPOLOGY_EXTEND,
DISPLAYCONFIG_TOPOLOGY_EXTERNAL,
DISPLAYCONFIG_TOPOLOGY_FORCE_UINT32
} ;
Some code,
QueryDisplayConfig(QDC_DATABASE_CURRENT, &requiredPaths, paths.data(), &requiredModes, modes.data(), ¤tTopologyId);
switch (currentTopologyId)
{
case DISPLAYCONFIG_TOPOLOGY_INTERNAL:
break;
case DISPLAYCONFIG_TOPOLOGY_CLONE:
{
std::wcout << "CLONE Mode" << L"\n";
break;
}
case DISPLAYCONFIG_TOPOLOGY_EXTEND:
{
std::wcout << "EXTEND Mode" << L"\n";
break;
}
case DISPLAYCONFIG_TOPOLOGY_EXTERNAL:
break;
default: break;
}
----------
Thank you!
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
You can record the targetid of the three monitors in advance, and correspond these values to DeviceName respectively. When two of the monitors use clone mode, they will return the DISPLAYCONFIG_TOPOLOGY_CLONE flag. Then check the returned targetid to determine the other monitor that was cloned.
P.S. I don't have a third monitor for testing, so I'm not sure whether the currentTopologyId will return a meaningful value under the call of QueryDisplayConfig for the monitor that has not been cloned.
This may not be a good method, but I hope it can provide some ideas for your problem.
Thanks for your answer. Unfortunately windows api changes the target id when you clone it. So storing target ids does not really work. I wish it did.
No, I mean id,
typedef struct DISPLAYCONFIG_PATH_TARGET_INFO {
LUID adapterId;
UINT32 id;
...
id : The target identifier on the specified adapter that this path relates to.
When I tested it, I didn't find that its value would be changed.
Sign in to comment