How to uniquely identify a monitor?
Asked Answered
B

1

6

I'm working on a project where I take screenshots of individual monitors (TMonitor) and stream their images through network (remote desktop viewing). Suppose a monitor is added/removed (which I can recognize this already), I need to synchronize which monitor this happened to. Because, suppose there's 3 monitors, indexes 0, 1, 2. Monitor 1 is removed. I don't want to automatically change index 2 to 1, I want it to maintain an ID at all times. Is there any property I can recognize in the TMonitor class (Screen.Monitors[i]) to uniquely identify it?

Bissextile answered 17/6, 2012 at 21:14 Comment(1)
Does the Windows handle stay the same? If not, you could try working with the monitor resolution. There doesn't seem to be any kind of unique identifier.Ytterbite
V
14

I would say that the Handle property of TMonitor will be unique at all times.

According to the documentation:

A physical display has the same HMONITOR as long as it is part of the desktop.

Viol answered 17/6, 2012 at 21:26 Comment(1)
HA! I can't believe I didn't see that, I was looking for IDBissextile

© 2022 - 2024 — McMap. All rights reserved.