LeapDayWilliam
LeapDayWilliam

Reputation: 197

Programmatically determine VGA or DVI on a primary monitor using Windows API?

If I can get a handle to a monitor and get the monitor's info using the handle and the "GetMonitorInfo" function from the windows API, is there some way I can determine more info like whether that monitor is using the DVI or the VGA port? Or what that device's name is?

Thanks.

Upvotes: 1

Views: 1288

Answers (1)

Jerry Coffin
Jerry Coffin

Reputation: 490128

I don't know of a direct way to retrieve the type of port used. About the best I know of is that you can use WMI to enumerate objects of the Win32_DesktopMonitor class, and guess at the connection based on the bandwidth property.

If you're willing to do a fair amount of work, you can sometimes improve your guess by enumerating Win32_VideoController objects. Some controllers only have VGA, and others only have DVI -- but if you get a controller that supports both, you're probably back to guessing based on the stated bandwidth (which may not be supplied either).

Upvotes: 1

Related Questions