How to detect hot plugging of monitor in a win32 application?

假装没事ソ 提交于 2019-11-27 03:35:11

问题


I need some kind of event from Windows whenever there is a monitor that's getting plugged into system. Is there any API in Windows to do that. BTW, it is an C++ application


回答1:


Use RegisterDeviceNotification to register for getting WM_DEVICECHANGE notification.




回答2:


You can do it via WMI, AFAIK. I've never tried it though so I can't give much help

Read here for more info: MSDN - Receiving a WMI Event



来源:https://stackoverflow.com/questions/1440285/how-to-detect-hot-plugging-of-monitor-in-a-win32-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!