File Extensions in MRU

The MRU (Most Recently Used) section of a Files menu shows files that were recently opened by an application. The default Windows way of displaying file names is to omit file extensions. This can become confusing when the application can handle several different file extensions. As an example, how do you distinguish between MP3 and WAV files in RecAll-PRO?

Even as the program creator, I wasn’t sure how to change this behavior without digging deep into the source code. Like most coders, I use a framework, a wrapper around the Windows API (Applications Programming Interface) to ease programming tasks. Delving in the framework source code, we discover the MRU menu item uses the Windows API GetFileTitle function.

GetFileTitle returns the string that the system would use to display the filename to the user. The display name includes an extension only if that is the user’s preference for displaying file names. This means that the returned string may not accurately identify the file if it is used in calls to file system functions.

Getting closer. How do we turn on display of file extensions? The answer is not exactly obvious. In Windows Explorer, click on menu Tools -> Folder Options -> View, and look under Advanced settings for “Hide extensions for known file types“. Un-select this item. MRUs for our application will now show extensions. (check for xp)

Here is how our MRU menu looks with file extensions displayed:

I notice that some other applications always display MRU file extensions, no matter the user preference setting. Should we change this behavior for our programs?

Leave a Comment