Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 15-06-2010
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 19.440
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Yo en alguna ocasión he itilizado este código (no es mío):

Código Delphi [-]
procedure RegisterFileTypeEx(cMyExt, cMyFileType, cMyDescription, ExeName: string;
                             sIconPath:string; sIconNumber:Integer; DoUpdate: boolean = false);
var
   Reg: TRegistry;
begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_CLASSES_ROOT;
    Reg.OpenKey(cMyExt, True);
    // Write my file type to it.
    // This adds HKEY_CLASSES_ROOT\.abc\(Default) = 'Project1.FileType'
    Reg.WriteString('', cMyFileType);
    Reg.CloseKey;
    // Now create an association for that file type
    Reg.OpenKey(cMyFileType, True);
    // This adds HKEY_CLASSES_ROOT\Project1.FileType\(Default)
    //   = 'Project1 File'
    // This is what you see in the file type description for
    // the a file's properties.
    Reg.WriteString('', cMyDescription);
    Reg.CloseKey;    // Now write the default icon for my file type
    // This adds HKEY_CLASSES_ROOT\Project1.FileType\DefaultIcon
    //  \(Default) = 'Application Dir\Project1.exe,0'
    Reg.OpenKey(cMyFileType + '\DefaultIcon', True);

    if (sIconPath = '') then begin
      Reg.WriteString('', ExeName + ',' + IntToStr(sIconNumber));
    end
    else begin
      Reg.WriteString('', sIconPath);
    end;
    Reg.CloseKey;
    // Now write the open action in explorer
    Reg.OpenKey(cMyFileType + '\Shell\Open', True);
    Reg.WriteString('', '&Open');
    Reg.CloseKey;
    // Write what application to open it with
    // This adds HKEY_CLASSES_ROOT\Project1.FileType\Shell\Open\Command
    //  (Default) = '"Application Dir\Project1.exe" "%1"'
    // Your application must scan the command line parameters
    // to see what file was passed to it.
    Reg.OpenKey(cMyFileType + '\Shell\Open\Command', True);
    Reg.WriteString('', '"' + ExeName + '" "%1"');
    Reg.CloseKey;
    // Finally, we want the Windows Explorer to realize we added
    // our file type by using the SHChangeNotify API.
    if DoUpdate then SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
  finally
    Reg.Free;
  end;
end;

Y la llamada era similar a esta:

Código Delphi [-]
      RegisterFileTypeEx(STR_EXT, STR_DESC_CNN,
                       STR_DESC_CNN,
                       Application.ExeName,
                       IcoName, 2,  // icono
                       True);

Los parámetros eran los siguientes:
* STR_EXT la extensión con la forma '.CNN';
* STR_DESC_CNN es una cadenas descriptiva tipo esta: 'Fichero de conexión'
* IcoName es el path donde está el icono a asociar.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Asociar Aplicación y Tipos de Archivo gaps2k Varios 1 10-04-2007 19:15:51
¿Como crear una aplicación cliente DCom de un servidor ya creado? Sergi Providers 1 08-01-2007 21:44:53
usar un programa ya creado para una nueva aplicacion fabriciof Varios 3 02-05-2004 20:50:31
Asociar archivo a mi aplicacion Alejo Varios 1 10-11-2003 06:36:37
Asociar Icono a un RES craven Gráficos 2 17-09-2003 23:44:03


La franja horaria es GMT +2. Ahora son las 05:42:30.


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