cwinapidisplaymultiple-monitors

Programmatically how to differentiate between 2 monitors {laptop integrated monitor, and external monitor connected via port}


I wanted to programmatically differentiate between two monitors using some parameters which says:

DISPLAYCONFIG_TOPOLOGY_ID specifies the type of display topology, but it does not specify which monitor is connected to which topology (e.g. internal, external clone, external extended, etc.).

I was looking around the PID and VID and other parameters of device manager but could not find relevant information.


Solution

  • typedef enum DISPLAYCONFIG_TOPOLOGY_ID { 
     DISPLAYCONFIG_TOPOLOGY_INTERNAL = 0x00000001,
     DISPLAYCONFIG_TOPOLOGY_CLONE = 0x00000002,
     DISPLAYCONFIG_TOPOLOGY_EXTEND = 0x00000004,
     DISPLAYCONFIG_TOPOLOGY_EXTERNAL = 0x00000008,
     DISPLAYCONFIG_TOPOLOGY_FORCE_UINT32 = 0xFFFFFFFF
    

    };

    https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ne-wingdi-displayconfig_topology_id