CWinAppEx - 重载 LoadState()
我有一个 MFC MDI 应用程序,当我运行它时,它会烦人地加载工具栏等的先前状态。我已经
m_bSaveState = FALSE;
在 App 构造函数中设置了...但没有效果。因此,我尝试重载 LoadState() 方法,如下所示:
// added this to the MainApp.h file
virtual BOOL LoadState(CWnd* pFrame, LPCTSTR lpszSectionName = NULL );
和 ...
// added the following to the MainApp.cpp
BOOL CDrumGenMDIApp::LoadState (CWnd* pFrame, LPCTSTR lpszSectionName )
{
// do nothing to pre-load the state from the Registry
return TRUE;
}
... 但是该方法似乎永远不会被调用。当系统加载框架时,我很确定它正在调用 LoadState() 的某些配置文件......但是我如何让它调用我的重载方法?
谢谢
I have an MFC MDI application that annoyingly loads up the previous state of toolbars, etc, when I run it. I've set
m_bSaveState = FALSE;
in the App constructor ... but it had no effect. So I've attempted to overload the LoadState() method as in:
// added this to the MainApp.h file
virtual BOOL LoadState(CWnd* pFrame, LPCTSTR lpszSectionName = NULL );
and ...
// added the following to the MainApp.cpp
BOOL CDrumGenMDIApp::LoadState (CWnd* pFrame, LPCTSTR lpszSectionName )
{
// do nothing to pre-load the state from the Registry
return TRUE;
}
... however this method appears never to be called. When the system is loading Frames I'm pretty sure it is calling some profile of LoadState() ... but how do I get it to call my overloaded method?
Thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看头文件,您尝试重写的函数未声明为虚拟函数也不存在?!
然而,以下功能是虚拟的:
我自己没有尝试过,但理论上它应该有效。
Looking at the header file, the function you are trying to override is not declared virtual nor does it exist?!
However the following function is virtual:
I have not tried this myself, but it should work in theory.