Bu, Dosya uzantılarının nasıl register edildiğini gösteren bir örnektir(.myext). Bir örnek uygulama (MyApp.Exe), yukarıdaki uzantıyı kullanmaktadır. Bunu windowsa kayıt edebilmenin yolu, bir kaç satır registry kou yazmaktan geçmektedir. Aşağıda bununla ilgili bir örneği görmektesiniz.
uses Registry;
procedure TForm1.Button1Click(Sender: TObject); var R : TRegIniFile; begin R := TRegIniFile.Create(''); with R do begin RootKey := HKEY_CLASSES_ROOT; WriteString('.myext','','MyExt'); WriteString('MyExt','','Some description of MyExt files'); WriteString('MyExtDefaultIcon','','C:MyApp.Exe,0'); WriteString('MyExtShell','','This_Is_Our_Default_Action'); WriteString('MyExtShellFirst_Action','','This is our first action'); WriteString('MyExtShellFirst_Actioncommand','', 'C:MyApp.Exe /LotsOfParamaters %1'); WriteString('MyExtShellThis_Is_Our_Default_Action','', 'This is our default action'); WriteString('MyExtShellThis_Is_Our_Default_Actioncommand', '','C:MyApp.Exe %1'); WriteString('MyExtShellSecond_Action','','This is our second action'); WriteString('MyExtShellSecond_Actioncommand', '','C:MyApp.Exe /TonsOfParameters %1'); Free; end; end;
|