如何在 MFC 中获取最近文件的列表



我正在尝试构建一个欢迎页面(基于CDHTmlDialog),在该欢迎页面中,我想显示我最近的文件列表。它应该看起来像Adobe 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();

MFC 中最近使用的文件列表在 CRecentFileList* CWinApp::m_pRecentFileList 中维护。您可以通过索引访问它,如下所示:

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

最新更新