1

这让我对自己感到难过:我无法说服 MRU 列表出现在我的 MFC 应用程序的菜单中,尽管事实上我所做的所有事情都与我在上一个项目中使用它时所做的相同,即是:

(a) 通过 CWinApp::InitInstance 中的 LoadStdProfileSettings() 加载 MRU,

BOOL CEditor::InitInstance(){
    if (!CWinApp::InitInstance()) return FALSE;
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);
    if (!ProcessShellCommand(cmdInfo)) return FALSE;
    LoadStdProfileSettings(); // begging you, do something!
    m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow();
    return TRUE;
}

(b) 将每个加载/保存的文件添加到 CDocument::Serialize 中的 MRU 列表中

void CDrive::Serialize(CArchive &ar){
    // serialization
    // - add to the MRU
    CFile *f=ar.GetFile();
    CString fileName=f->GetFileName();
    extern CEditor editor;
    editor.AddToRecentFileList(fileName);
    // - i/o
    // ...do the main objective...
}

正如标题中所指出的,一定是我一直忽略的非常愚蠢的东西。

非常感谢您的帮助。

托马斯

4

0 回答 0