_WinAPI_EnumDisplayDevices() reports 3 additional virtual monitors I don’t need. So I’ve created an If statement where if specific flags come about (such as 1, 2, 3, 35, or 33), it only returns those monitors. However, it bugs me how long my conditional statement is:
$_enum = _WinAPI_EnumDisplayDevices("", $x)
If $_enum[3] = 1 OR $_enum[3] = 2 OR $_enum[3] = 3 OR $_enum[3] = 33 OR $_enum[3] = 35 Then
How to get same results with less code?
Discovered
_ArraySearch()allows to search a value in an array, and returns different flags based on what it finds or doesn’t. So I can create an array with all values, then perform an_ArraySearch()for$_enum[3]against the array.I ended up with:
I’ve set all possible combinations of flags, successfully parsed what monitors are real (physical) vs not real (virtual) and even defined the machine’s default display as well.