From: uconrad@gmx.net (Ulli Conrad) Subject: Re: How do I set up file associations Date: 12 Mar 1999 00:00:00 GMT Message-ID: <36e93843.1022804@news.gwdg.de> References: <7cauip$had$1@newnews.global.net.uk> Organization: Goettingen University Reply-To: uconrad@gmx.net Newsgroups: alt.comp.lang.borland-delphi On Fri, 12 Mar 1999 11:38:51 -0000, "Paul Linsell" wrote: >How do I programmatically setup a file association in windows so that >Explorer knows that a particular file type can be opened by my application. Hi Paul, you have to create some registry values and keys under HKEY_CLASSES_ROOT: var Reg : TRegistry; begin Reg:=TRegistry.Create; Reg.RootKey:=hKey_Classes_Root; Reg.OpenKey('.ext',true); // create key for file extension Reg.WriteString('','MyExtension'); // Write alias Reg.CloseKey; // Close this key before opening another Reg.OpenKey('MyExtension,true); // Create alias key Reg.WriteString('','My registered file type'); // Write description Reg.CloseKey; // Close this key before opening another // The associated exe file is stored in the subkey /shell/open/command Reg.OpenKey('MyExtension\shell\open\command',true); Reg.WriteString('','c:\PathToMyApp\myapp.exe %1'); // Write the associated exe command string // This string contains path and filename of exe file as well as parameter // variable for opening, usually %1. Reg.Free; end; Hope this helps - Ulli - The Coder's Knowledge Base http://www.netalive.org/ckb