Modifying the New Submenu

The File menu in a file system folder contains a New submenu that, by default, includes the Shortcut and Folder commands. These commands allow the user to create new shortcuts and folders within the current folder. The New submenu can also include other nondefault commands that let the user create new files of various types within the current folder, such as sound files, text files, and bitmap files. For example, the New submenu might include a Sound command that creates a .WAV file in the current folder.

If your application creates a type of file that the user may want to create from within a file system folder, you should consider adding a command for it to the New submenu. For example, suppose you have created a graphics application that creates files with the .XYZ filename extension. You could add a command, such as XYZ Picture, that creates a new .XYZ file or launches your application and opens a new .XYZ file for editing.

You add a command to the New submenu by including a ShellNew key below the file association key for your filetype. When the system needs to create the New submenu, it searches through the file association entries for instances of the ShellNew key. When it finds an instance of ShellNew, the system retrieves the string associated with the application identifier key (xyzfile) and adds the string to the New submenu as a new command. Note that an Open command must be registered below the application identifier key; otherwise, the system does not add the Open command to the New submenu.

The following example shows the registry entries needed to add the XYZ Picture command to the New submenu.

HKEY_CLASSES_ROOT
.xyz="xyzfile"
ShellNew

NullFile=""

.

.

.

xyzfile="XYZ Picture"

shell

open

command="C:\XYZ\XYZAPP.EXE %1

The data names for the ShellNew key specify the method to use to create a new file of the type designated by the filename extension. There are four possible data names and values for the ShellNew key.

Data name
Value
Description
NullFile
""
Creates an empty (null) file. If this data name is specified, Data and FileName are ignored.
Data
binary-value
Creates a file that contains the data specified by binary-value. This data name is ignored if either NullFile or FileName is specified.
FileName
path-name
Creates a copy of the file specified by path-name. This data name is ignored if NullFile is specified.
Command
path-name
Executes the command specified by path-name when the file is created. For example, the command might start a wizard.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database