TIPS :: 
Most of the file types (files "grouped" by their extension) in Windows have an associated application which gets executed when a user double clicks a file in the Windows Explorer.
Sometimes, you will need to add (register) a custom command for a known file type. For example, you may want an option to open PAS files (Delphi units) with Notepad.
Read the full article to find out register or unregister a command for a file type (extension).
Related: Activate a Running Instance when a User Opens an Associated File (By Extension) | Get Associated application by Extension | How to Run your Application by Double-Clicking on a File (Register Extension)

Hi,
I always use the following code where the My* constants needs to be filled before calling the procedure.
It mainly differs by support for EditFlags, DefaultIcon, Content Type & AlwaysShowExtension.
The SHCHangeNotify updates the explorer to show the icons. It is known to cause problems on certain secured Novell based Lan’s where the explorer would not stop updating.
procedure T_MainForm.RegisterApplication;
var
reg : TRegistry;
buf : Dword;
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_CLASSES_ROOT;
//veg:Register my own filetype
if reg.Openkey(‘\’ + MyExt, True) then
begin
//assign appname_file to *.ext files
reg.WriteString(”, MyAppName + ‘_file’);
//propose a new mime type…
reg.WriteString(‘Content Type’, ‘application/’ + LowerCase(MyAppName));
if reg.Openkey(‘\’ + MyAppName + ‘_file’, True) then
begin
//Add the application used for appname_file
reg.WriteString(”, MyAppName + ‘ File’);
//Exact Purpose of editflags unknown
buf := 0;
reg.WriteBinaryData(‘EditFlags’, buf, 4);
//Always show extension
reg.WriteString(‘AlwaysShowExt’, ”);
//Change the icon to a large Application one
if reg.Openkey(‘\’ + MyAppName + ‘_file\DefaultIcon’, True) then
reg.WriteString(”, Application.ExeName + ‘,0′);
//Add the open verb
if reg.Openkey(‘\’ + MyAppName + ‘_file\shell’, True) and
reg.Openkey(‘\’ + MyAppName + ‘_file\shell\open’, True) and
reg.Openkey(‘\’ + MyAppName + ‘_file\shell\open\command’, True) then
reg.WriteString(”, Application.ExeName + ‘ “%1″‘);
end;
end;
reg.CloseKey;
reg.Destroy;
//can cause problems…
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
end;