CWinAppEx - 重载 LoadState()

发布于 2024-11-05 12:43:20 字数 627 浏览 4 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别再吹冷风 2024-11-12 12:43:20

查看头文件,您尝试重写的函数未声明为虚拟函数也不存在?!

然而,以下功能是虚拟的:

  virtual BOOL LoadState(LPCTSTR lpszSectionName = NULL, CFrameImpl* pFrameImpl = NULL);

我自己没有尝试过,但理论上它应该有效。

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:

  virtual BOOL LoadState(LPCTSTR lpszSectionName = NULL, CFrameImpl* pFrameImpl = NULL);

I have not tried this myself, but it should work in theory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文