简体   繁体   English

监视器数量变化时的通知是什么?

[英]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_CHANGEDWM_DEVICECHANGE (在RegisterDeviceNotification之后)。

You will see WM_SETTINGCHANGE for SPI_SETWORKAREA and SPI_ICONVERTICALSPACING . 你会看到WM_SETTINGCHANGESPI_SETWORKAREASPI_ICONVERTICALSPACING

And you will see registered messages "UxdDisplayChangeMessage" and "HotplugDetected" (second one only when adding monitor). 您将看到已注册的消息“UxdDisplayChangeMes​​sage”和“HotplugDetected”(仅在添加监视器时为第二个)。 You can use RegisterWindowMessage to get the identifier for these messages. 您可以使用RegisterWindowMessage获取这些消息的标识符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 作为Windows服务运行时,如何获取活动监视器的数量? C ++ - When running as a windows service, how do i get the number of active monitors? C++ 活动窗口更改时获取通知 - Getting notification when active window changes Win32中是否有消息或通知可以检测用户何时更改区域设置? - Is there a message or notification in Win32 that detects when user changes locale? 编辑控件 MFC 中 cursor position 更改时是否有通知代码? - Is there a notification code when cursor position changes in Edit Control MFC? 检索辅助监视器的DPI的正确方法是什么? - What's the correct way to retrieve the DPI of secondary monitors? 当我有2个监视器时,SDL_GetNumVideoDisplays()返回1 - SDL_GetNumVideoDisplays() returns 1 when I have 2 monitors 插入新监视器时 NSScreen 不更新监视器计数 - NSScreen not updating monitor count when new monitors are plugged in 使用DXGI将一台显示器切换到全屏模式时,其他显示器变黑 - Other monitors go black when switch one monitor to fullscreen with DXGI 当计算机处于睡眠状态时电源状态发生变化时,我会收到通知吗? - Can I get a notification when power state changes while computer is asleep? 解析(浮点)数字时使用什么信息? - What information is used when parsing a (float) number?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM