[英]What is the notification when the number of monitors changes?
I'm curious, what is the Win32 notification that is broadcast when the number of monitors in the system changes? 我很好奇,当系统中的监视器数量发生变化时,广播的Win32通知是什么? I thought it was WM_DISPLAYCHANGE but I was wrong.
我以为是WM_DISPLAYCHANGE,但我错了。
This is quite easy to check with Microsoft Spy++
. 使用
Microsoft Spy++
可以很容易地查看。 In my case I checked on Windows 7 x64 with two monitors connected and switching the second monitor off and on again. 在我的情况下,我检查了Windows 7 x64,连接了两台显示器,然后关闭再打开第二台显示器。
When removing a monitor you will see a WM_DISPLAYCHANGE
, but not when adding a monitor. 删除监视器时,您将看到
WM_DISPLAYCHANGE
,但在添加监视器时则不会。
You will see a WM_DEVICECHANGE
with DBT_DEVNODES_CHANGED
(after RegisterDeviceNotification ). 您将看到带有
DBT_DEVNODES_CHANGED
的WM_DEVICECHANGE
(在RegisterDeviceNotification之后)。
You will see WM_SETTINGCHANGE
for SPI_SETWORKAREA
and SPI_ICONVERTICALSPACING
. 你会看到
WM_SETTINGCHANGE
为SPI_SETWORKAREA
和SPI_ICONVERTICALSPACING
。
And you will see registered messages "UxdDisplayChangeMessage" and "HotplugDetected" (second one only when adding monitor). 您将看到已注册的消息“UxdDisplayChangeMessage”和“HotplugDetected”(仅在添加监视器时为第二个)。 You can use RegisterWindowMessage to get the identifier for these messages.
您可以使用RegisterWindowMessage获取这些消息的标识符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.