显示器的数量,位置或分辨率如何变化? [英] How to recognize when number, position, or resolution of monitors has changed?

查看:166
本文介绍了显示器的数量,位置或分辨率如何变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一些需要检测事件随监视器配置发生变化的内容。这包括监视器添加/删除,监视位置移动(与主屏幕相比),或监视器分辨率已更改。最理想的方法是捕捉一些Windows消息(如果有的话),这些消息在发生这种事件时被触发。该信息将用于在任何给定时间保持监视器大小/位置的实时记录。例如,当显示器的分辨率增加时,我的应用程序将马上抓住它,并进行自己的调整以适应变化。我如何捕捉这些事件?



我也试图避免使用VCL(如 Vcl.Forms.Screen.MonitorCount )这就是为什么我喜欢捕捉Windows消息。

解决方案

我可以想到的最明显的消息是 WM_DISPLAYCHANGE ,至少在更改分辨率时发送。


I'm building something which needs to detect when things change with the monitor configuration. This includes Monitor added/removed, Monitor position moved (compared to main screen), or when Monitor resolution has changed. The most ideal way would be catching some windows messages, if any, which are triggered when such events occur. This information will be used to keep a real-time record of the monitor sizes/positions at any given time. For example, when a monitor's resolution is increased, my app will catch this right away and make its own adjustments to accommodate for the change. How do I catch these events?

I'm also trying to avoid using VCL (such as Vcl.Forms.Screen.MonitorCount) which is why I prefer to catch a Windows Message.

解决方案

The most obvious message I can think of is WM_DISPLAYCHANGE which is sent, at least, when the resolution is changed.

这篇关于显示器的数量,位置或分辨率如何变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆