Tips for using Inno Setup
I. How to play music during installation of Inno Setup
Method (1 ):
Add the following code in the [Code] and [files] sections of the script Compilation:
[Code]
Function mcisendstring (lpszcommand: string; lpszreturnstring: integer; cchreturnlength: integer; hwndcallback: integer): integer;
External 'mcisendstringa @ winmm. dll stdcall ';
Procedure initializewizard ();
VaR
Bgmusicfile, splashfile: string;
Splashform: tform;
Splashfilename: string;
I: integer;
Begin
Extracttemporaryfile (extractfilename (expandconstant ('{TMP} \ musicloud ')));
Splashform: = tform. Create (NiL );
With splashform do
Begin
Mcisendstring (expandconstant ('play {TMP} \ musicket'), 0, 0 );
Close;
Free;
End;
End;
[Files]
Source: "C: \ musicloud"; flags: dontcopy
Or
Source: "C: \ mymusicloud"; destdir: "{TMP}"; flags: dontcopy
Code Description: In [Code], the blue code {TMP} And \ musicloud indicate playing the musicloud music file in the folder created during Inno setupinstallation!
In [files], c: \ musicloud is the address of your music source file. Fill in your audio name and format. Flags: dontcopy means to put the music file in the Temporary Folder created by Inno Setup during installation and delete the music file after installation!
2. How to modify the image in the installation wizard of Inno Setup
This is very simple. You only need to find it in the root directory of the Inno Setup Program.
Replace the two image files wizmodernsmallimage. BMP and wizmodernimage.bmp.
Where: wizmodernimage.bmp is the left-side figure (1); wizmodernsmallimage. BMP is the icon in the upper-right corner (2 ).
Note: the size of the image wizmodernimage.bmp is 164 × 314 wizmodernsmallimage. the size of the BMP image is 55 × 55 (I changed the size of the two images according to the default size. I have not tried other proportions, if you are interested, try it yourself .)
Iii. How to add text to the Inno Setup installation line
You only need to add a [messages] segment and enter the following code under this segment:
Beveledlabel = Professional
Code Description: The Green professional is a custom text. You can enter it at will!
Iv. How to create multiple Desktop shortcuts using Inno Setup
This is also very simple as long as you add the following code in the [icons] section:
Name: "{commondesktop} \ program Name 1"; Filename: "{app} \ InstVise.exe"; Tasks: worker topicon; WorkingDir: "{app }"
Name: "{commondesktop} \ program Name 2"; Filename: "{app} \ Translator.exe"; Tasks: worker topicon; WorkingDir: "{app }"
Description: program name 1 and program name 2 are the shortcut name, which is defined by yourself. InstVise.exe and Translator.exe are the source execution files in the root directory of the shortcut. (It is worth noting that, if you choose to use the Wizard to create and install and check whether or not to create a desktop shortcut in The Wizard shortcut project, the system automatically creates a shortcut for the master execution file in the [Icons] segment. The code is: Name: "{commondesktop }\{# MyAppName}"; Filename: "{app }\{# MyAppExeName}"; Tasks: {# MyAppName} in the topicon code indicates the name of the main execution file in the installation folder, {# MyAppExeName} indicates the name of the source execution file of the main execution file in the installation folder. Note that duplicate shortcuts are not allowed. If you want to use this code, add the green section later. WorkingDir: "{app}" is the starting position of the shortcut. This part is not available by default. The shortcut may fail to be opened !)
09.08.26 update added (the main execution files of some games or software are not included in the installation directory but in the sub-files of the installation directory. The solution to this problem is as follows): Test correction!
Bytes -----------------------------------------------------------------------------------------------------------
Name: "{commondesktop} \ shortcut program Name"; Filename: "{app} \ qq.exe"; Tasks: worker topicon; WorkingDir: "{app }"
Note: Pay attention to the blue part:
1. Add sub-directories in {app} \ qq.exe, for example, {app} \ sub-Folder 1 \ sub-Folder 2 \ qq.exe.
2. {app} will be added accordingly, for example: {app} \ subfolders 1 \ subfolders 2 \
Bytes -----------------------------------------------------------------------------------------------------------
V. Change the text color of the Inno Setup welcome page and the installation wizard text
We only need to create the [Code] section and add the following Code in this section:
[Code]
// Never forget me ~~
Procedure InitializeWizard ();
Begin
// Change the text color of the welcome page ()
WizardForm. WelcomeLabel1.Font. Color: = clNavy;
WizardForm. WelcomeLabel2.Font. Color: = clTeal;
// Change the color of text on other pages ()
WizardForm. PageNameLabel. Font. Color: = clred;
WizardForm. PageDescriptionLabel. Font. Color: = clBlue;
End;
Note: The light green logo in the Code is color, which can be replaced at will. Currently, only the following colors are supported!
Bytes -----------------------------------------------------------------------------------------------------------
ClBlack, clMaroon, clGreen, clOlive ),
ClNavy (dark blue), clPurple (purple), clTeal (dark blue), clGray (Gray ),
ClSilver (light gray), clRed (red), clLime (light green), clYellow (yellow ),
ClBlue, clFuchsia, clAqua, clWhite ).
Bytes -----------------------------------------------------------------------------------------------------------
6. Packaging, compression, and segmentation of Inno Setup binfiles
1. Split the binfile and add the following in [setup:
DiskSpanning = true
DiskSliceSize = 2100000000
Description: DiskSliceSize = 2100000000 is calculated in bytes. You can enter the number of shards you want to split. It seems that it cannot exceed 2200000000
2. The compression format of Inno Setup, Which is compressed according to the 7Z compression algorithm by default. Or in the [setup] section:
Found: Compression = lzma
Note: The Green lzma is the default compression format, that is, the default compression method of 7z. The following provides a practical
The compression method, that is, the ultimate compression of 7z.
Bytes -----------------------------------------------------------------------------------------------------------
Compression = none (this command is not compressed .)
Compression = lzma/ultra64 (This compression is a 7z ultimate compression algorithm, which consumes a lot of memory for a longer time. However, the compression ratio is good !)
Bytes -----------------------------------------------------------------------------------------------------------