Tu comunidad de Seguridad Informatica

Asociando Archivos en Delphi Info1810 Para ver Todo el contenido del foro es necesario estar Registrado! Asociando Archivos en Delphi Info1810
Asociando Archivos en Delphi Info1810 Antes de comentar o Aportar es Obligado Leer Las: Reglas | Rules Asociando Archivos en Delphi Info1810
Asociando Archivos en Delphi Info1810Ya Esta Disponible al publico "LeProject" el Videojuego del Foro Click Aquí Para Ver el Post. Asociando Archivos en Delphi Info1810
Asociando Archivos en Delphi Info1810Pitbull Security Labs "Extras" Esta Disponible! [ENTRA]Asociando Archivos en Delphi Info1810

No estás conectado. Conéctate o registrate

Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje [Página 1 de 1.]

1-Slandg- 

-Slandg-
Administrador
Administrador

http://www.pitbullsecurity.org
Mar Nov 16, 2010 8:00 pm
Código:
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;

Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje [Página 1 de 1.]

Permisos de este foro:
No puedes responder a temas en este foro.