Ver Mensaje Individual
  #2  
Antiguo 18-06-2003
Avatar de Investment
Investment Investment is offline
Miembro
 
Registrado: may 2003
Posts: 378
Reputación: 21
Investment Va por buen camino
TRUCO 203 del TRUCOMANIA:

-Añade ShlObj, ActiveX y ComObj en el uses de tu form
Y usa esta función para crear el acceso directo.

Por ejemplo, crear un acceso directo en el escritorio al Block de Notas que abra el Autoexec.bat:
Código:
 
procedure TForm1.Button1Click(Sender: TObject);
 
  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;
    FicheroP.Save(PWChar(WFichero),False);
  end; 
 
begin 
  CreaLnk( 'c:\windows\Notepad.exe', {Ejecutable}
           'c:\Autoexec.bat',        {Argumentos}
           'c:\',                    {Diretorio de trabajo}
           'Editar Autoexec.lnk',    {Nombre del Acceso Directo}
           'c:\windows\escritorio'   {Donde hay que crearlo}
           );
end;
__________________
Saludos,
Peter Investment
Responder Con Cita