Detecting screen monitor Power State change in c++

馋奶兔 提交于 2019-12-10 20:41:46

问题


I have a Windows message loop. I need to detect when the screen powers back up. Is there a windows message?

detect power state change contains the C# way, I need the C++ way, using win32 API.

If there isn't a Windows message, how do I poll for screen monitor power state?


回答1:


There is a Windows message WM_POWERBROADCAST. There Windows API has a lot of support for power management. See the section on Windows Power Management at MSDN for the details.




回答2:


For newer windows versions (starting with windows 8) you should use GUID_CONSOLE_DISPLAY_STATE instead of GUID_MONITOR_POWER_ON



来源:https://stackoverflow.com/questions/4580994/detecting-screen-monitor-power-state-change-in-c

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