MFC应用程序的电源故障保存状态

编程入门 行业动态 更新时间:2024-10-19 22:24:35
本文介绍了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应用程序的电源故障保存状态

本文发布于:2023-11-07 23:00:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1567674.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   故障   电源   状态   MFC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!