Associating Two or More Extensions
with a Single File Type
The problem with creating a new file type is that you often have to reinvent the wheel.
For example, let’s say you want to set up a new file type that uses the
These are usually text files (such as
readme.1st) that provide pre-installation instructions,
so you probably want to associate them with Notepad. However, this means repeating
some or all of the existing Text Document file types. To avoid this, it’s possible to tell
Windows XP to associate a second extension with an existing file type. Here are the steps
1. Open the Folder Options dialog box and display the File Types tab.
2. Click New. Windows XP displays the Create New Extension dialog box.
3. Type the File Extension for the new file type.
4. Click Advanced. The dialog box expands as shown in Figure 3.11.
Customizing the New Menu 73
FIGURE 3.11 The expanded version of the Create New Extension dialog box.
5. Use the Associated File Type list to select the file type for the new extension (such as
6. Click OK to return to the File Types tab.
Customizing the New Menu
One of Windows XP’s handiest features is the New menu, which enables you to create a
new file without working within an application. In Windows Explorer, select File, New, or
right-click inside the Contents pane and select New. In the submenu that appears, you’ll
see items that create new documents of various file types, including a folder, shortcut,
bitmap image, WordPad document, text document, compressed folder, and possibly many
others, depending on your system configuration and the applications you have installed.
What mechanism determines whether a file type appears on the New menu? The Registry,
of course. To see how this works, start the Registry Editor and open the
HKEY_CLASSES_ROOT key. As you’ve seen, most of the extension subkeys have only a
Default setting that’s either blank (if the extension isn’t associated with a registered file
type) or a string file that points to the extension’s associated file type.
However, lots of these extension keys also have subkeys and a few of them have a subkey
ShellNew, in particular. For example, open the .bmp key and you see that it has a
ShellNew. This subkey is what determines whether a file type appears on
the New menu. Specifically, if the extension is registered with Windows XP and it has a
ShellNew subkey, the New menu sprouts a command for the associated file type.
The ShellNew subkey always contains a setting that determines how Windows XP creates
the new file. Four settings are possible:
NullFile This setting, the value of which is always set to a null string (“”), tells Windows
XP to create an empty file of the associated type. Of the file types that appear
on the default New menu, three use the NullFile setting: Text Document
(.txt), Bitmap Image (.bmp), and WordPad Document (.doc).
FileName This setting tells Windows XP to create the new file by making a copy of
another file. Windows XP has special hidden folders to hold these template files.
These folders are user-specific, so you’ll find them in
%USERPROFILE%\Templates. On the default New menu, only the Wave Sound
(.wav) file type uses the FileName setting, and its value is sndrec.wav. To see
this value, you need to open the
Command This setting tells Windows XP to create the new file by executing a specific
command. This command usually invokes an executable file with a few
parameters. Two of the New menu’s commands use this setting:
• Shortcut—The .lnk\ShellNew key contains the following value for the
rundll32.exe appwiz.cpl,NewLinkHere %1
• Briefcase—In the .bfc\ShellNew key, you’ll see the following value for
the Command setting:
system32\syncui.dll,Briefcase_Create %2!d! %1
Data This setting contains a binary value, and when Windows XP creates the new
file, it copies this binary value into the file. The New menu’s Compressed
(Zipped) Folder command uses this setting, which you can find here:
CHAPTER 3 Mastering File Types74