Board index » delphi » Associating file extension with application in Registry?

Associating file extension with application in Registry?

I have written a application and want a certain file extension to be
associated with this application. I want to make these changes
programatically. What keys and values need to be changed in the registry?

I want to:
Register the file-type
Add an "open-action" that starts my application
Assign a certain icon to the file-type

What needs to be assigned in the Registry? Do I have to include the
icon-file in the installation of the application? I would like to avoid
that.

Thanks in advance

Tomas

 

Re:Associating file extension with application in Registry?


Quote
>   "Tomas Elison" <d93-...@nada.kth.se> writes:
>  I have written a application and want a certain file extension to be
>  associated with this application. I want to make these changes
>  programatically. What keys and values need to be changed in the registry?

I have not tried that but I suppose it has to do with adding your file extension to the HKEY_CLASSES_ROOT and point it to a declaration further down where the action
is specified.
Most commonly with the location of the exe followed by a %1 for the filename to be opened.

But what I do know is that when you have that in place. ( I think i merly doubleclicked on a file of mine and then chosed my program to be the default program for that
type and then this info was done by W95. Maybe you can start with a clean machine with your program and a file and do this operation and then check out the registry
for traces of your program.)

Anyway.
With the extension in HKEY_CLASSES_ROOT you can add a key that you call ShellNew. In that key you add a value called Nullfile with value ""

With this operation you will get your filetype added to the rightclick create menu choice.

If your program need files that are preformatted in some ways you add such an "empty" file to the windows shellnew directory and then change the Nullfile key under
your shellnew key to read FileName and then as value enter the name of your "empty" copy in windows\shellnew.

This way when you rightclick and chose create and a file of your type you will get a copy of this "empty" file to start with.

johan

Other Threads