Open up the registry and look at the HKEY_CLASSES_ROOT, all the information about the default file types and mappings are stored here. You will need to add two entries to the root of this folder. Right click on the HKEY_CLASSES_ROOT folder and select New Key. Create a key with the same name as your file extension, for our example we will use .ken as our extension.
Set the default value to the name of your application, for example we will user KenEdit.
Now create a second key in the root of HKEY_CLASSES_ROOT called the same name as your application we will use KenEdit again. NOTE These two names must match.
Create a key named shell under the program name entry.
Create a key named open under the shell key entry.
Create a key named command under the open key entry.
Set the default value for the command key to the name of the application that will edit the files, we will use WordPad for our demonstration so enter the full path to the WordPad program.
Now you should be able to double click on files with a .ken extension in explorer and have it open up the file in WordPad. So now on to adding the KenEdit application to the New menu:
Create a dummy/empty file with the application that will create the new file types, for our example open up wordpad and type Ken as some text.
Then Save the file to a directory called ShellNew under your windows directory as KenEdit.ken, you can call the file whatever you want but by convention we use the programs name and the correct file extension.
Now go back to the registry and under the key for the file extension we created earlier called .ken create a new key called ShellNew.
Under the ShellNew key create a string called FileName and set the value of the FileName to be the name of the empty file we created in step 2 KenEdit.ken.
This is all you need to make the process work but to make things look a little slicker goto the KenEdit key we created in the root folder and set the default value for this key to be a nice name for your application we will user Kens Editor File.
Tuesday, 27 November 2007
Subscribe to:
Posts (Atom)