Jump to content
Sign in to follow this  

Problem with native resolution query

Recommended Posts


I'm using the code provided in the post at the link above, but I'm having issues with the native resolution query.

The code does work but I'm using it on machines attached to a KVM...which means that there isn't always a monitor attached when this runs. When no monitor is attached it returns the max resolution for the adapter instead of the max supported monitor resolution.

My first thought was OK no problem I'll just detect whether a monitor is attached first. In looking over the forums I'm not seeing a good way to do this. WMI won't work because it only evaluates at boot time. The only thing I've been able to find is a difference in the _WinAPI_EnumDisplayDevices() state flags. When the monitor is attached I'm getting a 35, but when it's not I get a 3. Not a real good way to detect since the bit difference means "The device has more display modes than it's output devices support". Which might flag even if the monitor is connected depending on the monitors capabilities.

Can anyone think of a way to workaround this issue?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this