本文介绍了使用ENDSESSION_CLOSEAPP和wParam == FALSE对WM_ENDSESSION的正确响应是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 WM_ENDESSION 文档,当lParam为ENDSESSION_CLOSEAPP而wParam为FALSE时,应用程序应关闭".

According to the WM_ENDESSION docs, when lParam is ENDSESSION_CLOSEAPP and wParam is FALSE, "the application should not shut down".

  • 因此,我应该忽略它并使用默认响应吗?
  • 目的是什么?

(我正在听Qt(C ++)中的Windows事件/消息以关闭一些已启动的进程,但这只是上下文,在这里不应该有任何影响...)

(I'm listening to Windows events/messages in Qt (C++) to shutdown some launched processes, but that's just the context and shouldn't have any bearing here...)

推荐答案

是的,带有wParam==falseWM_ENDSESSION仅用于提供信息.在收到此信息之前,您的应用程序将收到WM_QUERYENDSESSION.如果您为响应WM_QUERYENDSESSION做好了准备关闭的准备,则当/如果您收到带有wParam=falseWM_ENDSESSION,则可以取消该操作.如果您尚未采取任何措施开始关闭,则只需返回0即可.

Yes, a WM_ENDSESSION with wParam==false is simply for information. Prior to receiving this, your application will have received a WM_QUERYENDSESSION. If you did something to get ready to shut down in response to the WM_QUERYENDSESSION, you can un-do it when/if you received a WM_ENDSESSION with wParam=false. If you haven't taken any steps to start shutting down, you can just return 0.

这篇关于使用ENDSESSION_CLOSEAPP和wParam == FALSE对WM_ENDSESSION的正确响应是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 11:21