如何覆盖“最近使用过的文件"列表中存储的文件 [英] how can I override what files are stored in the Most Recently Used file list

查看:90
本文介绍了如何覆盖“最近使用过的文件"列表中存储的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个资源管理器样式的MFC SDI应用程序.

我想在文件"菜单选项中列出最近使用的文件.但是,我只希望文件显示在此列表中且具有某些内容.更具体地说,它们必须是xml文件(* .xml),并且必须具有特定的标题< tag>.里面.因此,我不能仅通过检查文件是否具有.xml扩展名来挑选出哪些打开的文件应包含在此列表中.
我想我可以覆盖打开的文件添加到此列表的位置,并且仅在打开特定的typeof文件时调用将函数添加到MRU列表的功能.请让别人告诉我这是否可行,并给我一些入门的提示.

非常感谢:)

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 :)

推荐答案

此链接可能有用 [^ ]


您要查找的函数是CDocument:SetPathName(LPCTSTR lpszPathName,BOOL bAddToMRU)

这是负责将文件添加到MRU的功能.如果我没记错的话,它是虚拟的,因此您可以在文档类的实现中提供自己的实现.

这可以检查文件扩展名和其他参数,以查看是否应执行对
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);

的调用.

根据所使用的VC版本,应将函数的开始代码作为原始CDocument实现的副本进行基础,然后可以在派生的CDocument类中对其进行修改.

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.


这篇关于如何覆盖“最近使用过的文件"列表中存储的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆