2011-05-06 22 views
0

我有一個MFC MDI應用程序,當我運行它時,惱人地加載工具欄等的以前的狀態。我已經設置了CWinAppEx - 重載LoadState()

m_bSaveState = FALSE; 

在應用構造函數中......但它沒有效果。所以,我已經嘗試過載運行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()的一些配置文件...但我如何讓它調用我的重載方法?

THX

回答

0

望着頭文件,您試圖重寫不宣虛擬也不存在功能?

然而下面的函數是虛擬的:

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

我還沒有嘗試過這個自己,但它應該在理論工作。