Oriel Dayanim
Oriel Dayanim

Reputation: 139

How to get a list of recent files in MFC

I am trying to build a welcome page (which is CDHTmlDialog based) and in that welcome page i want to present a list of my recent files. it should look like Adobe Reader welcome page.

I tried to get the recent file list by getting the MRU list and it's not going so well.

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();

Upvotes: 4

Views: 2283

Answers (1)

Andrew Komiagin
Andrew Komiagin

Reputation: 6556

The list of recent files in MFC is maintained in CRecentFileList* CWinApp::m_pRecentFileList. You can access it by index like this:

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

Upvotes: 4

Related Questions