laitimes

How to make an installation package with Inno Setup?

author:Yibaite Internet of Things application

This document mainly describes how to make an installation package with Inno Setup, if the content to be packaged is ready, you can skip the "QT operation" part.

QT operation

1. Set the compilation mode to Release in QT, click Compile to find the generated exe file in the folder, and copy it out and put it in a separate folder.

How to make an installation package with Inno Setup?

2. Considering that the user may install the software into a system folder such as Program Files (x86), there will be some problems if the program does not have administrator privileges, so you can add administrator privileges to the compiled exe. In the project folder, create a .manifest file in the same directory as the pro file, here the author uses getAdmin.manifest as an example. Write the following code to getAdmin.manifest:

1. <?xml version='1.0' encoding='UTF-8' standalone='yes'?>

2.<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>

3. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">

4. <security>

5. <requestedPrivileges>

6. <requestedExecutionLevel level='requireAdministrator' uiAccess='false' />

7. </requestedPrivileges>

8. </security>

9. </trustInfo>

10.</assembly>

Then find the .rc file with the same name as the exe file compiled by the project, and add the following code to it.

1.1 24 DISCARDABLE "getAdmin.manifest"

If you can't find the .rc file, you can create one yourself, here the author uses getAdmin.rc as an example. Write the above code to the created getAdmin.rc file, and then open the pro file in QT and add the following statement.

2.RC_FILE += getAdmin.rc

If there is a small shield in the lower right corner of the compiled exe file icon, it means that the administrator permission has been added successfully.

3. Find QT 5.14.2 (MinGW) by searching, the version is selected according to the compiler of the QT project, if it is a 32-bit compiler, then MinGW uses the 32-bit version. If the QT project uses the MSVC compiler, the same version of the MSVC compiler is also selected.

How to make an installation package with Inno Setup?

4. Once opened, type in "CD Path to EXE File" to make the tool find the EXE file storage location. Then enter "WinDeployQT File Name .exe" and the tool will automatically add the .dall file that this exe file requires. However, the .dall file added by the tool may not be complete, so after the .dall file is automatically added, manually click the exe file, if an error is reported, then according to the prompt information, find the corresponding dall file in the QT installation folder and add it manually. Until you click the exe, it can be opened and used normally.

How to make an installation package with Inno Setup?

Anthem Setup操作

1. After opening Inno Setup, select Use Wizard and follow the prompts to create a script template.

How to make an installation package with Inno Setup?

2. Click Next and fill in the program information.

How to make an installation package with Inno Setup?
How to make an installation package with Inno Setup?

3. Click Browse and select the exe file you prepared earlier. Click Add File to add all other files in the same directory as the exe file. Click Add Folder to add all the other folders in the exe file directory. Click Next when you're done.

How to make an installation package with Inno Setup?

4. Select the creation shortcut according to your needs, and complete the next step.

How to make an installation package with Inno Setup?

5. The license file is not necessary, click Browse to add a pre-installation and post-installation display information file, the pre-installation display information file is usually a user agreement. TXT and RTF file formats are supported, click Next after the addition is complete.

How to make an installation package with Inno Setup?

6. Language selection Chinese.

How to make an installation package with Inno Setup?

7. Select the storage location, name and icon of the compiled installation package, and the installation password can be set without setting.

How to make an installation package with Inno Setup?

8. Select Yes, use #define compilation instructions, and click Next to complete the template creation. A pop-up prompt will ask "Do you want to start compiling now", click No.

How to make an installation package with Inno Setup?

9. Modify the code generated by the template to add a folder. The template code generated by the wizard will copy the files in the folder to the same directory as the exe and delete the original folder, which will cause an error message in the exe file after installation. Modify the code to the following format, click compile to get the simplest installation package.

1.Source: "C:\Users\21195\Desktop\11\platforms\*"; DestDir: "{app}\platforms"; Flags: ignoreversion recursesubdirs createallsubdirs

2.Source: "C:\Users\21195\Desktop\11\iconengines\*"; DestDir: "{app}\iconengines"; Flags: ignoreversion recursesubdirs createallsubdirs

10. On the wpInfoBefore page, which is the one that says "Show pre-installation files", add a checkbox. The checkbox reads "The author has read and agrees to this agreement", and the "Next" button on that page is set to unavailable by default. Only if the user checks the box and agrees to the agreement, can click Next to continue the installation, the code is as follows.

1. Was

2. AgreementCheckBox: TNewCheckBox;

3. procedure AgreementCheckBoxClick(Sender: TObject);

4. begin

5. // Update the status of the Next button

6. WizardForm.NextButton.Enabled := AgreementCheckBox.Checked;

7. end;

8. procedure InitializeWizard;

9. begin

10. // Create a checkbox control

11.

12. AgreementCheckBox := TNewCheckBox.Create(WizardForm);

13. AgreementCheckBox.Parent := WizardForm.InfoBeforePage;

14. AgreementCheckBox.Left := WizardForm.InfoBeforePage.Left + ScaleX(0);

15. AgreementCheckBox.Top := WizardForm.InfoBeforePage.Height - ScaleY(22);

16. AgreementCheckBox.Width := WizardForm.InfoBeforePage.ClientWidth - Scale X(16);

17. AgreementCheckBox.Caption := '笔者已阅读,并同意该协议';

18. AgreementCheckBox.Checked := False;

19. AgreementCheckBox.OnClick := @AgreementCheckBoxClick;

20.

21. end;

22. procedure CurPageChanged(CurPageID: Integer);

23. begin

24. // Disable the Next button when the InfoBeforePage page

25. if CurPageID = wpInfoBefore then

26. WizardForm.NextButton.Enabled := False;

27. end;

How to make an installation package with Inno Setup?

11. In order to avoid errors due to insufficient permissions during installation, you can add administrator privileges to the installation package. Add PrivilegesRequired=admin to the [Setup] node of the script. Go to the root directory of the Inno Setup installation and find the file SetupLdr.e32, which is a binary configuration file that needs to be modified with the ResHacker.exe tool. Find <requestedExecutionLevel level="asInvoker" uiAccess="false"/></requestedPrivileges> and change it to <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/></requestedPrivileges>, as shown in the figure below. After recompilation, if a small shield appears in the lower right corner of the installation package, the administrator privileges have been added successfully.

How to make an installation package with Inno Setup?

Other articles are recommended to read:

"Innovative! Strong Adaptability Serial Server, RJ45 and Serial Port Two-way Conversion + Multi-communication Mechanism"

"High-performance and low-latency 4G CAT1 module, 4G full Netcom + high-precision positioning"

"LoRa Micro DTU, Subverting Design! Wireless Data Radio Can Be So Small"

Three Low-Power Modes, Multi-socket, Ultra-Low-Power Wireless Serial Wi-Fi Module

Read on