MFC应用程序的电源故障保存状态 [英] power failure saving state of MFC application

查看:115
本文介绍了MFC应用程序的电源故障保存状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在MFC应用程序中发生电源故障时保存应用程序的状态,以便下次计算机启动时可以将应用程序加载到其最后的状态?

How to save the state of application when power failure occures in MFC application so when next time computer started i can load application to its last state?

推荐答案

您可能会发现无法捕获实际的电源故障(请参见此处 [ ^ ]),因此在这种情况下您无法采取任何措施来保持自己的身份.最好的答案是,只要您的应用程序中的数据发生更改,都应尽快更新文件.
You may find that it is not possible to capture an actual power failure (see here[^]) so there is no action that you can take to preserve your status in such a situation. The best answer would be to update your files as soon as possible whenever the data in your application changes.


CWinAppEx的对象会处理
CWinAppEx::LoadState(..)开头和
CWinAppEx::SaveState(..)退出时,
如果没有定义-由您-为您的CWinAppEx-公共应用程序...

...因此您也可以在保存状态"框架上放置工具栏按钮
随时显式调用第二个函数,而无需退出...:)
An object of the CWinAppEx does process
CWinAppEx::LoadState(..) at its starting and
CWinAppEx::SaveState(..) at its exiting,
when it was not defined else - by you - for your CWinAppEx-public application...

...so you could also place a toolbar button at your frame "Save state"
to call the second function explicitly, at any time, without exiting... :)


这篇关于MFC应用程序的电源故障保存状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆