开发者

CWinAppEx - overloading LoadState()

开发者 https://www.devze.com 2023-03-03 20:47 出处:网络
I have an MFC MDI application that annoyingly loads up the previous state of toolbars, etc, when I run it.I\'ve set

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号