How to get monitor ID?

2.6k views Asked by At

I use WMDisplayChange to get notified when a monitor gets connected/disconnected because I need to load from a INI file information specific to that monitor.

What I don't know is how to know that an "known" monitor was reconnected to the PC. How to get monitor's unique ID? Windows obviously does it because it remembers the last resolution used on that monitor.

I tried this library but the ID returned looks like this (the number in brackets seems not to be unique).

enter image description here (one of the monitors is Dell, the others are Asus )

Update:
The number at the end of the ID (ex: 0009) seems to be some kind of unique ID. If I disconnect and reconnect a monitor, that number is remembered for that reconnected monitor. I even swapped the connector to a new port. The 0009 changed to 0008 but then when I put it back to the original HDMI port, it turned back to 0009.

This number seems to be equal to the chronological order in which the monitors were added to the system. Of course, connecting the same monitor to different port, makes the monitor to appear as "new monitor".

0

There are 0 answers