Modified version of hfs that integrate this function, can every body test and report, specially with system as Vista, win2003Server, Win2000, Win98 ....
(Please do not report with WIN XP system)
procedure TmainFrm.Edit1Click(Sender: TObject);
function getDefaultTextEditor():string;
var editor:string;
begin
//search the openas default program for .txt extension
editor:=lowercase(loadregistry('Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt','application',HKEY_CURRENT_USER));
//If the value does not exist, then load contents
//of default 'Open Command' value for the same extension
if editor='' then
begin
editor:=loadregistry('.txt','',HKEY_CLASSES_ROOT);
editor:=lowercase(loadregistry(editor+'\shell\Open\command','',HKEY_CLASSES_ROOT));
editor:=chop('.exe',editor);
while pos('\',editor)>0 do chop('\',editor);
editor:=editor+'.exe';
end;
//path of editor is automatic with windows XP by associate an extension with a program file
result:=editor;
end;
begin
if not fileExists(tplFilename) then
begin
tplFilename:=TPL_FILE;
saveFile(tplFilename, defaultTpl);
end;
exec(or_([
tplEditor,
getDefaultTextEditor(),
loadregistry('SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\notepad++.exe', '', HKEY_LOCAL_MACHINE),
'notepad.exe'
]), '"'+tplFilename+'"');
end;
When changing external template, you can see it now in the external editor
procedure TmainFrm.Changefile1Click(Sender: TObject);
begin
tplImport:=selectFile(tplFilename, 'Change template file', 'Template file|*.tpl', [ofPathMustExist, ofCreatePrompt]);
Edit1Click(edit1);
end;