win32:获取监视器的当前DEVMODE

发布于 2024-10-02 16:08:16 字数 193 浏览 1 评论 0原文

win32下如何获取当前分辨率?我知道我可以使用 GetMonitorInfo 来获取监视器的当前边界矩形,但是我如何才能获取位深度?差不多,我如何获取给定监视器的 DEVMODE 结构?

我使用的是 python 和 pywin32,因此专门解决这些问题的解决方案很好,但只需 winapi 调用即可。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

邮友 2024-10-09 16:08:16

除了 Dean 的答案中提到的 EnumDisplayMonitors 函数之外,您还需要 GetDeviceCaps ()。请参阅参数 BITSPIXEL:它为您提供每个像素的相邻颜色位数。

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.

2024-10-09 16:08:16

您需要使用EnumDisplayMonitors 函数,它为每个监视器调用回调并传递矩形和设备上下文(其中包括颜色信息)。

pywin32 有 win32api.EnumDisplayMonitors,它似乎在幕后使用 EnumDisplayMonitors返回一个具有与我上面提到的相同详细信息的列表。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文