【问题标题】:How to get a list of recent files in MFC如何在 MFC 中获取最近文件的列表
【发布时间】:2026-02-22 03:00:02
【问题描述】:

我正在尝试构建一个欢迎页面(基于 CDHTmlDialog),并且在该欢迎页面中我想展示我最近的文件列表。 它应该看起来像 Adob​​e Reader 欢迎页面。

我试图通过获取 MRU 列表来获取最近的文件列表,但它并不顺利。

LoadStdProfileSettings(5);  // Load standard INI file options (including MRU)

m_pRecentUrls = new CRecentFileList('0', L"Recent URL List", L"%d", 5, URL_MRU_ENTRY_LEN);
m_pRecentUrls->ReadList();

【问题讨论】:

    标签: c++ visual-studio visual-c++ mfc dialog


    【解决方案1】:

    MFC 中最近的文件列表保存在CRecentFileList* CWinApp::m_pRecentFileList 中。您可以像这样通过索引访问它:

    CString CMyApp::GetRecentFile( int index ) const  
    {  
        return (*m_pRecentFileList)[ index ];  
    } 
    

    【讨论】:

      最近更新 更多