Outils pour utilisateurs

Outils du site


prog:inno_setup

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
prog:inno_setup [2016/11/15 17:59] – Ajout de "Modification de la base de registre" rootprog:inno_setup [2022/02/11 21:56] (Version actuelle) – Mise à jour v6.2.0 root
Ligne 1: Ligne 1:
-[[http://www.jrsoftware.org/isdl.php|Site Web]], {{ :prog:inno_setup:innosetup-5.5.9-unicode.exe |Archive v5.5.9}}+[[http://www.jrsoftware.org/isdl.php|Site Web]], {{ :prog:inno_setup:innosetup-6.2.0.exe |Archive v6.2.0}}
  
 =====Modifier un fichier après installation===== =====Modifier un fichier après installation=====
Ligne 6: Ligne 6:
 Ajouter après chaque fichier une directive ''AfterInstall''. Ajouter après chaque fichier une directive ''AfterInstall''.
  
-''Source: "C:\fichier.txt"; DestDir: "{app}"; Flags: ignoreversion; AfterInstall: FileReplaceString('fichier.txt')+''Source: %%"C:\fichier.txt"; DestDir: "{app}"%%; Flags: ignoreversion; AfterInstall: FileReplaceString('fichier.txt')
 '' ''
  
Ligne 12: Ligne 12:
 <code pascal> <code pascal>
 procedure FileReplaceString(const FileName: string); procedure FileReplaceString(const FileName: string);
-var+va
   MyFile : TStrings;   MyFile : TStrings;
   MyText : string;   MyText : string;
Ligne 39: Ligne 39:
 Root: HKLM; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\prog.exe"; ValueData: "RUNASADMIN" Root: HKLM; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\prog.exe"; ValueData: "RUNASADMIN"
 </code> </code>
 +
 +=====Création d'un raccourci=====
 +[[https://raw.githubusercontent.com/rgl/elasticsearch-setup/master/shortcut.pas|shortcut.pas]], {{ :prog:inno_setup:shortcut.pas |Archive}}
 +
 +<code pascal>
 +const
 +  CLSID_ShellLink = '{00021401-0000-0000-C000-000000000046}';
 +
 +type
 +  IShellLinkW = interface(IUnknown)
 +    '{000214F9-0000-0000-C000-000000000046}'
 +    procedure Dummy;
 +    procedure Dummy2;
 +    procedure Dummy3;
 +    function GetDescription(pszName: String; cchMaxName: Integer): HResult;
 +    function SetDescription(pszName: String): HResult;
 +    function GetWorkingDirectory(pszDir: String; cchMaxPath: Integer): HResult;
 +    function SetWorkingDirectory(pszDir: String): HResult;
 +    function GetArguments(pszArgs: String; cchMaxPath: Integer): HResult;
 +    function SetArguments(pszArgs: String): HResult;
 +    function GetHotkey(var pwHotkey: Word): HResult;
 +    function SetHotkey(wHotkey: Word): HResult;
 +    function GetShowCmd(out piShowCmd: Integer): HResult;
 +    function SetShowCmd(iShowCmd: Integer): HResult;
 +    function GetIconLocation(pszIconPath: String; cchIconPath: Integer;
 +      out piIcon: Integer): HResult;
 +    function SetIconLocation(pszIconPath: String; iIcon: Integer): HResult;
 +    function SetRelativePath(pszPathRel: String; dwReserved: DWORD): HResult;
 +    function Resolve(Wnd: HWND; fFlags: DWORD): HResult;
 +    function SetPath(pszFile: String): HResult;
 +  end;
 +
 +  IPersist = interface(IUnknown)
 +    '{0000010C-0000-0000-C000-000000000046}'
 +    function GetClassID(var classID: TGUID): HResult;
 +  end;
 +
 +  IPersistFile = interface(IPersist)
 +    '{0000010B-0000-0000-C000-000000000046}'
 +    function IsDirty: HResult;
 +    function Load(pszFileName: String; dwMode: Longint): HResult;
 +    function Save(pszFileName: String; fRemember: BOOL): HResult;
 +    function SaveCompleted(pszFileName: String): HResult;
 +    function GetCurFile(out pszFileName: String): HResult;
 +  end;
 +
 +procedure CreateShortCut(const FileName: string; const argument: string; const destination: string);
 +var
 +  Obj: IUnknown;
 +  SL: IShellLinkW;
 +  PF: IPersistFile;
 +begin
 +  if IsTaskSelected('shortcutstart') then
 +  begin
 +    { Create the main ShellLink COM Automation object }
 +    Obj := CreateComObject(StringToGuid(CLSID_ShellLink));
 +
 +    { Set the shortcut properties }
 +    SL := IShellLinkW(Obj);
 +    OleCheck(SL.SetPath(ExpandConstant('{app}') + '\' + FileName));
 +    OleCheck(SL.SetArguments(argument));
 +    OleCheck(SL.SetShowCmd(SW_SHOWNORMAL));
 +
 +    { Save the shortcut }
 +    PF := IPersistFile(Obj);
 +    OleCheck(PF.Save(ExpandConstant('{commonstartup}') + '\' + destination + '.lnk', True));
 +  end;
 +end;
 +</code>
 +
 +Exemple d'utilisation :
 +  AfterInstall: CreateShortCut('runner.exe', ExpandConstant('{app}\file.exe'), 'Raccourci')
prog/inno_setup.1479229153.txt.gz · Dernière modification : 2016/11/15 17:59 de root