CWinAppEx - overloading 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
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.
精彩评论