question

mcangny-2998 avatar image
0 Votes"
mcangny-2998 asked StriveSun-MSFT edited

can external monitor adapterid be used to identify whether it is cloned or not?

Hello,

QueryDisplayConfig function returns the list of paths related to displays. In clone mode both cloned monitors has same adapterid. Is this information reliable?

Is there any document regarding winapi display library regarding display modes and id explained?

Best regards,
Murat.

windows-api-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

StriveSun-MSFT avatar image
0 Votes"
StriveSun-MSFT answered StriveSun-MSFT edited

Hello, @mcangny-2998

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(), &currentTopologyId);
     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.


· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello

Letsay I have 3 screens 2 of them are cloned. How can I match those two cloned screen using adapterid/targetid/sourceid/modeidx infromations?

Best regards,
Murat.

0 Votes 0 ·

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.

0 Votes 0 ·

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.

0 Votes 0 ·
Show more comments