Customizing the Windows XP New Menu


One of the handiest features in Windows XP is the New menu, which allows 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. On the submenu that appears, you’ll see items that create new documents of various file types, including a folder, shortcut, bitmap image, WordPad document (or Word document, if Word is installed on the computer), 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 we discuss in Chapter 2, the first 300 or so subkeys of HKEY_CLASSES_ROOT are the file extensions that Windows XP recognizes. Most of these keys contain only a Default setting that takes either of the following values:

  • If the extension is registered with Windows XP, the Default value is a string pointing to the file type associated with the extension. For example, the default value for .txt is txtfile (text document).

  • If the extension isn’t registered with Windows XP, the Default value isn’t set.

A few of these extension keys, however, also have subkeys. For example, open the .bmp key and you see that it has a subkey named 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 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%\Template. On the 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 following key:

    HKCR\.wav\ShellNew
  • 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 HKCR\.lnk\ShellNew key contains the following value for the Command setting:

      rundll32.exe appwiz.cpl,NewLinkHere %1
    • Briefcase In the HKCR\.bfc\ShellNew key, you’ll see the following value for the Command setting:

      %SystemRoot%\system32\rundll32.exe %SystemRoot%
      \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:

    HKCR\.zip\CompressedFolder\ShellNew
    Insider_Secret

    You’ll notice that some extension keys have multiple ShellNew subkeys. For example, in a default installation of Windows XP, the .doc key has four ShellNew subkeys:

    .doc\ShellNew  .doc\Word.Document.6\ShellNew  .doc\WordDocument\ShellNew  .doc\WordPad.Document.1\ShellNew

    Which of these subkeys does Windows XP use when constructing its New menu? The answer is: the subkey that corresponds to the registered file type. In a default installation of Windows XP, for .doc files, the registered file type is WordPad.Document.1, so it’s the .doc\WordPad.Document.1 \ShellNew subkey that Windows XP uses in the New menu.

Adding File Types to the New Menu

To make the New menu even more convenient, you can add new file types for documents you work with regularly. For any file type that’s registered with Windows XP, you follow a simple three-step process:

  1. Add a ShellNew subkey to the appropriate extension key in HKEY_CLASSES_ROOT.

  2. Add one of the four settings discussed in the preceding section (NullFile, FileName, Command, or Data).

  3. Enter a value for the setting.

In most cases, the easiest way to go is to use NullFile to create an empty file. The FileName setting, however, can be quite powerful because you can set up a template file containing text and other data.

Deleting File Types from the New Menu

Many Windows XP applications (such as Microsoft Office) like to add their file types to the New menu. If you find that your New menu is getting crowded, you can delete some commands to keep things manageable. To do this, you need to find the appropriate extension in the registry and delete its ShellNew subkey.

Caution

Instead of permanently deleting a ShellNew subkey, you can tread a more cautious path by simply renaming the key (to, for example, ShellNewOld). This will still prevent Windows XP from adding the item to the New menu, but it also means that you can restore the item just by restoring the original key name.




Insider Power Techniques for Microsoft Windows XP
Insider Power Techniques for Microsoft Windows XP (Bpg-Other)
ISBN: 0735618968
EAN: 2147483647
Year: 2005
Pages: 126

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net