Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Registrar extensiones de ficheros en Delphi (https://www.clubdelphi.com/foros/showthread.php?t=80770)

JF Sebastian 16-10-2006 22:01:40

Registrar extensiones de ficheros en Delphi
 
Un pequeño truco para registrar desde Delphi las extensiones de archivos en el Registro de Windows.
Me he decidido a postearlo pues habia buscado con anterioridad aqui y no lo habia encontrado hasta que di con la solucion. Espero que sea de ayuda.
Un Saludo.
Código Delphi [-]
procedure RegisterFileType(ExtName:String; AppName:String; DefaultIcon:string);
var
  reg:TRegistry;
begin
  reg := TRegistry.Create;
  try
    reg.RootKey:=HKEY_CLASSES_ROOT;
    reg.OpenKey('.' + ExtName, True) ;
    reg.WriteString('', ExtName + 'file') ;
    reg.CloseKey;
    reg.CreateKey(ExtName + 'file') ;
    reg.OpenKey(ExtName + 'file\DefaultIcon', True) ;
    reg.WriteString('', AppName + ','+DefaultIcon) ;
    reg.CloseKey;
    reg.OpenKey(ExtName + 'file\shell\open\command', True) ;
    reg.WriteString('',AppName+' "%1"') ;
    reg.CloseKey;
  finally
    reg.Free;
  end;

  SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil) ;
end;

German 25-10-2006 02:46:45

http://clubdelphi.com/foros/showthread.php?t=30627

:)

JF Sebastian 25-10-2006 17:17:59

Oñe, perdon, ni me di cuenta que habia ya algo dicho sobre el tema


La franja horaria es GMT +2. Ahora son las 20:40:39.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi