If a monitor is disabled when I run GetAllPotentialDisplays, I have no way to enable it. But if I use an earlier returned value, it works.
Here's an easy repro:
# display 0 is enabled
$displays = WindowsDisplayManager\GetAllPotentialDisplays
$displays[0].disable() # Returns True, display 0 is disabled now.
$displays[0].enable() # Returns True, display 0 is enabled now.
$displays[0].disable() # Returns True, display 0 is disabled now.
$displays = WindowsDisplayManager\GetAllPotentialDisplays # display 0 now has no target.
$displays[0].enable() # Returns True, but nothing happens.
Output with display 0 enabled:
Display ID Description Active Enabled Primary Resolution HDR Info Position Recommended Resolution Source Target
---------- ----------- ------ ------- ------- ---------- -------- -------- ---------------------- ------ ------
0-4353 AW3423DWF via NVIDIA True True False Width : 3440 HdrSupported : True X : 3840 Width : 3440 Id : 0 Id : 4353
GeForce RTX 4090 Height : 1440 HdrEnabled : True Y : 0 Height : 1440 Name : \\.\DISPLAY1 FriendlyName : AW3423DWF
RefreshRate : 60 BitDepth : 10 Description : NVIDIA ConnectionType :
GeForce RTX 4090 DisplayportExternal
1 Unconnected NVIDIA True False True Width : 3840 N/A X : 0 N/A Id : 1 None
GeForce RTX 4090 Height : 2160 Y : 0 Name : \\.\DISPLAY2
source RefreshRate : 120 Description : NVIDIA
GeForce RTX 4090
2 Unconnected NVIDIA False False False N/A N/A N/A N/A Id : 2 None
GeForce RTX 4090 Name : \\.\DISPLAY3
source Description : NVIDIA
GeForce RTX 4090
3 Unconnected NVIDIA False False False N/A N/A N/A N/A Id : 3 None
GeForce RTX 4090 Name : \\.\DISPLAY4
source Description : NVIDIA
GeForce RTX 4090
If a monitor is disabled when I run GetAllPotentialDisplays, I have no way to enable it. But if I use an earlier returned value, it works. Here's an easy repro:
Output with display 0 enabled:
Output with display 0 disabled: