Implementing a "Most Recent Files" list

Z

zacks

Most applications whose purpose is to work with various types of files
implement a "Most Recent Files" list, where the last, say, four files
accessed by the application can quickly be re-opened by clicking on
the file name in the File menu. Thist list is usually just above the
typical Exit menu item.

I take it there is no "automatic" way of implementing this, that each
application has to have code that manually does this. I have a good
idea how to implement such a list, but it sure would be easier if
there was some automatic way of doing it, similar to the Windows menu
item that shows the current list of mdi child windows.

Any suggestions?
 
R

rowe_newsgroups

Most applications whose purpose is to work with various types of files
implement a "Most Recent Files" list, where the last, say, four files
accessed by the application can quickly be re-opened by clicking on
the file name in the File menu. Thist list is usually just above the
typical Exit menu item.

I take it there is no "automatic" way of implementing this, that each
application has to have code that manually does this. I have a good
idea how to implement such a list, but it sure would be easier if
there was some automatic way of doing it, similar to the Windows menu
item that shows the current list of mdi child windows.

Any suggestions?

Well, you could always switch to C++ and use MFC - it's application
generator includes the Recent Files functionality. :)

Besides that, I say you write a dll that has the functionality and
just add it to the various projects you need it for. The following
codeproject article might be a useful read:

http://www.codeproject.com/csharp/mru.asp

Thanks,

Seth Rowe
 
S

scorpion53061

Most applications whose purpose is to work with various types of files
implement a "Most Recent Files" list, where the last, say, four files
accessed by the application can quickly be re-opened by clicking on
the file name in the File menu. Thist list is usually just above the
typical Exit menu item.

I take it there is no "automatic" way of implementing this, that each
application has to have code that manually does this. I have a good
idea how to implement such a list, but it sure would be easier if
there was some automatic way of doing it, similar to the Windows menu
item that shows the current list of mdi child windows.

Any suggestions?

I would use and XML file and store recently accessed files there and
then populate the drop down with that information.
 
S

scorpion53061

Most applications whose purpose is to work with various types of files
implement a "Most Recent Files" list, where the last, say, four files
accessed by the application can quickly be re-opened by clicking on
the file name in the File menu. Thist list is usually just above the
typical Exit menu item.

I take it there is no "automatic" way of implementing this, that each
application has to have code that manually does this. I have a good
idea how to implement such a list, but it sure would be easier if
there was some automatic way of doing it, similar to the Windows menu
item that shows the current list of mdi child windows.

Any suggestions?

I would use and XML file and store recently accessed files there and
then populate the drop down with that information.
 
Z

zacks

Well, you could always switch to C++ and use MFC - it's application
generator includes the Recent Files functionality. :)

Besides that, I say you write a dll that has the functionality and
just add it to the various projects you need it for. The following
codeproject article might be a useful read:

http://www.codeproject.com/csharp/mru.asp

This code looks interesting. It brings up the notion that there are
two basic ways a most recent files list is implemented, either where
each of the most recent files occupay a separate menu item in the
Files menu, or, in this case, a sub-menu from a menu item labelled
Recent Files. I'm guessing the submenu method would be easier to code.

It also uses the registry to store the list of most recent files. I
would like to avoid using the registry. I would also like to avoid an
external XML file as another responder suggested. I am thinking of
using the My.Settings to store the list of most recent files. That
would keep it all inside the application. Of course, that would cause
the same list of recent files shown for any user who runs the app on
the same computer (like in a Citrix environment), where the registry
would be a better choice. But with the app I am currently working on,
it will be used by a user who has sole access to their own self-
contained workstation, so I am still leaning to the My.Settings.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top