Receive event before Windows enters standby or hibernate using Win32 API

元气小坏坏 提交于 2019-12-06 13:35:29

问题


I'm working on a small chat application written in C++/Qt. My users are complaining that the connection is not shut down gracefully when they are closing the laptop lid and the computer enters standby.

Is there a Win32 hook available that is called when Windows is about to enter standby?


回答1:


WM_POWERBROADCAST




回答2:


Reimplement QCoreApplication::winEventFilter in your application to handle Windows standby events.



来源:https://stackoverflow.com/questions/5440133/receive-event-before-windows-enters-standby-or-hibernate-using-win32-api

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