Claudiu
Claudiu

Reputation: 229361

win32: get current DEVMODE of a monitor

How can I get the current resolution in win32? I know I can use GetMonitorInfo to get the current bounding rectangle of the monitor, but how can I also get the bit-depth? Pretty much, how do I get the DEVMODE struct of a given monitor?

I'm using python and pywin32, so solutions addressing those specifically are nice, but just the winapi calls will do.

Upvotes: 2

Views: 1735

Answers (2)

Bill
Bill

Reputation: 11822

In addition to the EnumDisplayMonitors function mentioned in Dean's answer you need GetDeviceCaps(). See parameter BITSPIXEL: it gives you the number of adjacent color bits for each pixel.

Upvotes: 1

Dean Harding
Dean Harding

Reputation: 72658

You'll want to use the EnumDisplayMonitors function, which calls a callback for each monitor and passes the rectangle and a device context (which includes the colour information).

pywin32 has win32api.EnumDisplayMonitors, which appears to use EnumDisplayMonitors under the covers to return a list with the same details as I mentioned above.

Upvotes: 0

Related Questions