Click here to Skip to main content
12,065,888 members (30,363 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++ MFC
Hi,

I have an explorer style MFC SDI application.

I want to have a list of most recently used files in the 'File' menu option. However, I only want files to appear in this list that have certain contents. More specifically, they must be xml files (*.xml) and they must have a certain title inside. So I cannot just pick out which opened files should go in this list just by checking if they have the .xml extension.

I imagine I can override the point at which opened files are added to this list and only call the function to add files to the MRU list when I am opening the specific typeof file. Please could somebody tell me if this is possible, and give me some hints on how to get started.

Very many thanks Smile | :)
Posted 25-Jul-11 6:27am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
she-programmer 26-Jul-11 5:18am
   
Thankyou - I had tried to search for info but was obviously not picking te right words. Very many thanks!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

The function you are looking for is CDocument:SetPathName(LPCTSTR lpszPathName, BOOL bAddToMRU)

This is the function responsible for adding files to the MRU. If I remember correctly it is virtual so you can provide your own implementation in your document class's implementation.

This can check the file extension and other parameters to see whether the call to
AfxGetApp()->AddToRecentFileList(m_strPathName);
should be performed or not.

Depending on the version of VC you are using, you should base the start code of your function as a copy of the original CDocument implemenattion which you can then modify in your derived CDocument class.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160207.1 | Last Updated 26 Jul 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100