电脑在关机时向正在运行的程序会发送消息吗?

ienable 2003-07-09 04:33:33
电脑在关机时向正在运行的程序会发送消息吗?发些什么消息, 如何截获这些消息 ?
...全文
172 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
mafangsan 2003-07-09
  • 打赏
  • 举报
回复
呵呵
楼上的有道理
flyidd 2003-07-09
  • 打赏
  • 举报
回复
还要看你是以什么样的方式关机,如果是拔电源的话,应用级的程序一般是不会收到消息的.
HanZhu1 2003-07-09
  • 打赏
  • 举报
回复
一定会发结束消息
theone 2003-07-09
  • 打赏
  • 举报
回复
用户选择关机,Logout后,系统将发送这个消息给每个正在运行的程序来查询时候可以中止程序运行(你也可以在这里阻止系统关机),你可以在收到这个消息后做你 想要做的动作,就像Word会提醒你保存文件一样。
一下来自MSDN

Parameters
wParam
This parameter is reserved for future use.
lParam
Specifies whether the user is logging off or shutting down the system. If this parameter includes the ENDSESSION_LOGOFF value, the user if logging off. (Note that this parameter is a bit mask. To test for this value, use a bitwise operation; do not test for equality.)
Windows 2000: If this parameter is zero, the system is shutting down.

Return Values
If an application can terminate conveniently, it should return TRUE; otherwise, it should return FALSE.
abrams 2003-07-09
  • 打赏
  • 举报
回复
After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message.
abrams 2003-07-09
  • 打赏
  • 举报
回复
The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls the ExitWindows function. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero
yanice 2003-07-09
  • 打赏
  • 举报
回复
楼上的能说详细点吗?WM_QUERYENDSESSION在何处被触发?
theone 2003-07-09
  • 打赏
  • 举报
回复
WM_QUERYENDSESSION
bhut 2003-07-09
  • 打赏
  • 举报
回复
应该发送结束线程的消息

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧