Generally, the icon of the installation file generated by Inno is a CD and a display, such. At the same time, after the program is installed, the uninstall program icon under the installation directory is the same, in fact, we can also modify it ourselves. First generate the installation file icon. This is relatively simple. You only need to add the corresponding statement in the Setup section:
[Setup] ; Custom program installation package icon SetupIconFile = installer icon. ico |
This statement specifies the icon of the output file. If the icon is not in the same directory as the script, you must provide the complete path. Change to the following path:
[Setup] ; Custom program installation package icon SetupIconFile = F: \ Installer icon. ico |
Then there is the uninstall program icon. In fact, after compiling a program that contains the preceding replacement statement and installing it, you will find that the uninstallation program is replaced by the installation program icon, the installer automatically replaces the icon. The problem is, what should I do if I want to install different icons? The implementation method is as follows: 1. Prepare the icon file. 2. Use a plug-in named UpdateIcon. dll 3. Add the Files section. The Code is as follows:
[Files] ; NOTE: Don't use "Flags: ignoreversion" on any shared system files ; Unmount icon position Source: "F: \ icon. ico"; Flags: solidbreak dontcopy ; Uninstall plug-in location Source: "F: \ UpdateIcon. dll"; Flags: solidbreak dontcopy
|
4. Add the Code segment. The Code is as follows:
[Code]
// Plug-in function usage // Parameter: handle (parent handle of the plug-in error dialog box), full path name of the exe file, icon Resource Name (to be replaced in the exe file), full path name of the icon file, (the resource of the icon to be replaced in exe) language family // Return value: Success = True, failure = False Function UpdateIcon (const hWnd: Integer; const exeFileName, exeIcon, IcoFileName: String; wlangID: DWORD): Boolean; External 'updateicon @ files: UpdateIcon. dll stdcall '; // Replace the uninstall program icon Function UpdateUninstIcon (const IcoFileName: String): Boolean; Begin // If the path name of the exe file to be replaced is left blank, the plug-in will automatically replace the Inno uninstall program icon! Other parameters are similar! Result: = UpdateIcon (MainForm. Handle, '','', IcoFileName, 0); // Replace the uninstall icon End; Procedure CurStepChanged (CurStep: TSetupStep ); Var SIcon: String; Begin // Note: the icon for replacing the uninstall program must be before the uninstall program is generated! // It is recommended that the format and size of the installation icon be the same as that of the uninstallation icon. Otherwise, the uninstallation program may fail! If CurStep = ssInstall then Begin SIcon: = ExpandConstant ('{tmp} \ icon. ico'); // defines the uninstall icon // ExtractTemporaryFile ('updateicon. dll '); ExtractTemporaryFile (ExtractFileName (sIcon); // release the unload icon // If the path name of the exe file to be replaced is left blank, the plug-in will automatically replace the Inno uninstall program icon! If UpdateUninstIcon (sIcon) then // Replace the uninstall icon MsgBox ('uninstall program icon replaced successfully! ', MbInformation, MB_ OK) Else MsgBox ('failed to replace the uninstall program icon! ', MbError, MB_ OK ); End; End;
|
Attach a comment image to help you understand the code, such: After compilation, you can. The output file and installed directory are as follows: Installation File Installation Directory |