Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 <tag> 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 :)
Posted

 
Share this answer
 
Comments
Jackie Lloyd 26-Jul-11 5:18am    
Thankyou - I had tried to search for info but was obviously not picking te right words. Very many thanks!
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
MIDL
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900