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

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 25-Jul-11 6:27am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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
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
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.

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
Web01 | 2.8.170217.1 | Last Updated 26 Jul 2011
Copyright © CodeProject, 1999-2017
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