Posteado por: marswalker | pm

Asociación de archivos con la aplicación

procedure Asociaciondearchivos;
var
reg: TRegistry;
FileExt : String;
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_CLASSES_ROOT;
reg.LazyWrite := false;
//Ejemplo de extención
FileExt := ‘.XYZ’;
//Borrar la Clave – Esto es importante !!!
reg.OpenKey(FileExt, true);
reg.WriteString(, FileExt);
reg.CloseKey;
//Invocamos al programa pasando el nombre del fichero como primer parámetro
reg.OpenKey(FileExt + ‘\shell\open\command’, true);
reg.WriteString(, Application.ExeName + ‘ "%1"’);
reg.CloseKey;
//El icono mostrado será el primer icono del ejecutable del programa
reg.OpenKey(FileExt + ‘\DefaultIcon’, true);
reg.WriteString(, Application.ExeName + ‘,0′);
reg.CloseKey;
reg.free;
end;

Advertisement

Deja un comentario

Fill in your details below or click an icon to log in:

Logo de WordPress.com

You are commenting using your WordPress.com account. Log Out / Cambiar )

Twitter picture

You are commenting using your Twitter account. Log Out / Cambiar )

Facebook photo

You are commenting using your Facebook account. Log Out / Cambiar )

Connecting to %s

Categorías

Seguir

Get every new post delivered to your Inbox.