Unfortunately we don’t have such a test project. But we can explain you how to access the recent file list information stored inside MFC. First of all, you will need this C++ class for performing acrobatic tricks with MFC:
class InternalFriendlyWinApp : CWinApp
{
public:
inline static InternalFriendlyWinApp * _GetFriendlyApp()
{
CWinApp * pApp = ::AfxGetApp();
ASSERT( pApp != NULL );
return (InternalFriendlyWinApp *)pApp;
}
CRecentFileList * _GetRecentFileList()
{
return m_pRecentFileList;
}
}; // class InternalFriendlyWinApp
The following line of code returns the MFC’s recent file list information:
CRecentFileList * pRecentFileList = InternalFriendlyWinApp::_GetFriendlyApp()->_GetRecentFileList();
Please note, the returned pointer can be
NULL
if there are no recent files.
Then you can take a look at the source code of the
CExtPopupMenuWnd::_BuildItems()
internal method which performs the acrobatic tricks with the
CRecentFileList
object including the display name and relative path formatting.
The Office 2007 / 2010 recent file list is specific for the Office applications. It’s not needed for all the applications. That’s why we provide just a gallery inside ribbon file menu - not the recent file list viewer. Besides, MFC’s recent file list is single object and file list size is limited to 16 items. We have customers who support more lengthy recent file lists and multiple recent file lists.