How To Register Own File Types | |||
| |||
uses registry; procedure TForm1.RegisterFileType(prefix:String; exepfad:String); var reg:TRegistry; begin reg:=TRegistry.Create; reg.RootKey:=HKEY_CLASSES_ROOT; //create a new key --> .pci reg.OpenKey('.'+prefix,True); //create a new value for this key --> pcifile reg.WriteString('',prefix+'file'); reg.CloseKey; //create a new key --> pcifile reg.CreateKey(prefix+'file'); //create a new key pcifileDefaultIcon reg.OpenKey(prefix+'fileDefaultIcon',True); //and create a value where the icon is stored --> c:project1.exe,0 reg.WriteString('',exepfad+',0'); reg.CloseKey; reg.OpenKey(prefix+'fileshellopencommand',True); //create value where exefile is stored --> c:project1.exe "%1" reg.WriteString('',exepfad+' "%1"'); reg.CloseKey; reg.Free; SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil); end; procedure TForm1.Button1Click(Sender: TObject); begin RegisterFileType('pci','c:project1.exe'); end; Tags: Delphi File Association File Type File Type Registration | |||
| |||
| |||
Login for comment |