Ver Mensaje Individual
  #5  
Antiguo 31-07-2010
Avatar de Lord Delfos
Lord Delfos Lord Delfos is offline
Miembro
 
Registrado: ene 2008
Ubicación: Tandil, Argentina
Posts: 558
Reputación: 17
Lord Delfos Va por buen camino
Honestamente, creo que la mejor manera es también la más básica, que es poner un acceso directo en Menú Inicio > Inicio del usuario.

Esto es por tres cosas.

1) El usuario sabe qué se está corriendo al inicio.
2) Es fácil de borrar.
3) No te metés con el registry, cosa que puede ser peligrosa si uno no tiene cuidado.

Es uno opinión, nada más.


Código Delphi [-]
uses ShlObj, ComObj, ActiveX;

function RutaCarpetaEspecial(Carpeta: Cardinal): string;
var path: array [0..MAX_PATH] of char;
begin
  ShGetSpecialFolderPath(0,@path[0],Carpeta,false(*true crea la carpeta *)) ;
  Result:= path;
end;


//Sacado de Trucomanía: www.trucomania.org/trucomania
procedure CreaLnk(Exe, Argumentos, DirTrabajo, NombreLnk, DirDestino: string);
var Objeto: IUnknown;
    UnSlink: IShellLink;
    FicheroP: IPersistFile;
    WFichero: WideString;
begin
  Objeto := CreateComObject(CLSID_ShellLink);
  UnSlink := Objeto as IShellLink;
  FicheroP := Objeto as IPersistFile;
  with UnSlink do
    begin
    SetArguments( PChar(Argumentos) );
    SetPath( PChar(Exe) );
    SetWorkingDirectory( PChar(DirTrabajo) );
    end;
  WFichero := DirDestino + '\' + NombreLnk + '.lnk';
  FicheroP.Save(PWChar(WFichero),False);
end;

procedure TForm1.btn1Click(Sender: TObject);
begin
  CreaLnk( Application.ExeName,
           '',
           ExtractFilePath(Application.ExeName),
           'Mi programa',
           RutaCarpetaEspecial(CSIDL_STARTUP));
end;
Responder Con Cita