I wrote this code, which seems to work well, including in virtual machines. VM detection matters because In a VM you probably need to specify a maximum valid resolution (as it can only check adapter values) and the refresh rate won't really be variable as it has to match the @DESKTOP rate. In a non-VM you can usually use the maximum returned resolution (as the monitor is usually genuine hardware), but the refresh rate is best limited out of caution to ~ 85 - 100 Hz when automated. The code l