[TRUCO DELPHI] Poner tu programa en el menu de Inicio y en el Escritorio.
delphi
procedure TForm1.AddToStartMenu; var MyObject : IUnknown; MySLink : IShellLink; MyPFile : IPersistFile; Directory : String; WFileName : WideString; MyReg : TRegIniFile; begin MyObject := CreateComObject(CLSID_ShellLink); MySLink := MyObject as IShellLink; MyPFile := MyObject as IPersistFile; with MySLink do begin SetArguments(PChar(application.exename)); SetRelativePath(PChar(ExtractFilePath(application.exename)),0); SetHotKey(635); //Define el Acceso Directo - Ctl-F12 SetWorkingDirectory(PChar(ExtractFilePath(application.exename))); SetDescription(PChar('Tu Desripcion')); SetIconLocation(PChar(application.exename),0); //Icono del menu de Inicio. end; MyReg := TRegIniFile.Create( 'Software\MicroSoft\Windows\CurrentVersion\Explorer'); // Programa en el Escritorio Directory := MyReg.ReadString('Shell Folders','Desktop',''); // Programa en el Menu de Inicio Directory := MyReg.ReadString('Shell Folders','Start Menu','')+ '\Programs\YourProgram'; CreateDir(Directory); WFileName := Directory+'\Mi Sistema.lnk'; MyPFile.Save(PWChar(WFileName),False); MyReg.Free; end;
Saludos!