私は、特にマルチモニターを使用するように設計されたメイン レイアウトを維持するために、ディスプレイ デバイス (私の場合はテレビ) を識別するためのソリューションに取り組んできました。
6台のテレビが接続されているとしましょう。(通常、そのうちの 3 つは HDMI ポート経由、残りの 3 つは DVI ポート経由 (DVI-to-HDMI アダプターを使用)) で、物理的な位置は次のように 3x2 です。
TV1 ... TV2 ... TV3
TV4 ... TV5 ... TV6
目標
特定のテレビごとに全画面コンテンツを表示したいと考えています。Content1 は TV1 に移動する必要があり、Content2 は TV2 に移動する必要があります。つまり、Windows の動作によって変更される可能性があるため、場所や画面ではなく、コンテンツを DisplayDevice (テレビ) にプッシュする必要があります。(下記参照)
ご存知かもしれませんが、Windows は、接続された順序でディスプレイ デバイスを列挙しません (または、実際にはまったく規則に基づいていませんか?)。たとえば、次のように、まったく異なる方法でディスプレイを列挙します。
\.\DISPLAY3 ... \.\DISPLAY6 ... \.\DISPLAY1
\.\DISPLAY4 ... \.\DISPLAY2 ... \.\DISPLAY5
What I do to get over this, I order the televisions in Display Settings manually when I'm finished connecting all of them to match with their real locations.
The Issue
But there 's a problem here: Some television models just pretend like they 've been unplugged when they're switched off (or set to stand-by mode) and that causes Windows to drop the display device from the system and re-enumerate the display devices all over again.
Because of this behaviour (of both some television models and the Windows itself) I can not count on Screen.DisplayName property or even Screen.Location because they are variables. They both change right after the re-enumeration process.
これまでに試した解決策
すべてのディスプレイ デバイスのシリアル番号を取得しようとしましたが、それらの番号を Screen.DisplayName と関連付ける方法を見つけられると考えました。実際には、SetupAPI の EnumDisplayDevices を使用してそこにたどり着きましたが、ほとんどのテレビに有効な SerialNumber がないことに気付いた後、これはすべて無駄になりました。Samsung TV でさえ SerialNumber を持っていません (しかし、Samsung モニターには確かにあるので、「モニター」と「テレビソイン」の違いについてだと思います)。
結局..
I'm still looking a way to get over this issue. The other idea that comes to my mind is, maybe I should stop trying to push the content to the Display Device (because they are unidentifiable) Maybe I should try to push the content to the graphic card's ports, which means I must determine which ports of graphic cards correlates to which display device (Screen) but I am all talking without any knowledge about it - without even knowing if such a thing is possible or not.
I'm looking for your advices, thanks by now.