我们如何知道系统状态,例如关机,系统锁定等.
问题描述:
我有一个MFC应用程序,该应用程序在Windows启动时开始执行.当应用程序结束时,它将日志文件保存在temp文件夹中.有时,当发生不正确的关闭时,我的应用程序结束而没有写入日志文件.如何消除这种情况?我们如何知道系统状态,例如关闭,系统锁定等.请提供一些提示.
谢谢
Mithun Nair
Hi,
I have an MFC application and that starts execution when windows starts.When the application ends, It keeps a log file in temp folder. Some times,when improper shut down occurs, my application ends without writing the log file. How can I remove this situation? how can we know system status like shut down, system locked etc.. Please give some hints.
Thanks
Mithun Nair
答
只要发生任何更改,就立即写入日志?还是像MS Word的自动保存一样定期更新?
Write the log immediately, whenever some change occurs? Or update it periodically, like MS Word''s auto-save?
看看WM_QUERYENDSESSION
消息:
http://msdn.microsoft.com/en-us/library/aa376890% 28VS.85%29.aspx [ ^
Hi,
have a look at theWM_QUERYENDSESSION
message:
http://msdn.microsoft.com/en-us/library/aa376890%28VS.85%29.aspx[^