Inno Setup to make the installation package

Source: Internet
Author: User

1. Get the SQL Server installation path
Var
dbpath:string;
Rtn:boolean;
RTN: = Regquerystringvalue (HKEY_LOCAL_MACHINE, ' Softwaremicrosoftmssqlserversetup ', ' SQLPath ', dbpath);
if (!RTN) then dbpath: = Expandconstant (' {app} ');

2. Get the IP address of this machine
ip:string;
Rtn:boolean;

RTN: =regquerystringvalue (HKEY_LOCAL_MACHINE, ' systemcurrentcontrolsetservices{ 083565f8-18f0-4f92-8797-9ad701fcf1bf}parameterstcpip ', ' IpAddress ', IP);

if (not RTN) or (ip= ' 0.0.0.0 ') or (ip= ") then IP: = ' 127.0.0.1 ';

3. Modify the bitmap on the left side of the installation package , which is generally 164x314px in size and add the following code to the [Setup] section of the Inno script:

Wizardimagefile=reswizardimage.bmp


Note: The red marker is a bitmap path, which can be used with relative or absolute paths

4. Modify the upper-right bitmap of the installation package , which is generally 55x55px in size, add the following code to the [Setup] section of the Inno script:
Wizardsmallimagefile=reswizardsmallimage.bmp

5. There are two common ways to modify the Beveledlabel content in the lower left corner of the installation package :
(1) Temporary modification Add the following code to the [Messages] segment of the Inno script:

beveledlabel= software Chinese: Gaofang (Raindy)

  
(2) Permanent modification use Notepad to open the contents of "DEFAULT.ISL" in the Inno directory after modifying "Beveledlabel =":

beveledlabel= software Chinese: Gaofang (Raindy)



6. Modify the installation package welcome tag content, i.e. WelcomeLabel2
Open "Default.isl" in the Inno directory with Notepad to modify the contents of "WelcomeLabel2 =":

Welcomelabel2= is preparing to install [name/ver]...%n%n recommends that you close all other applications before proceeding with the installation.] %n%n software Chinese: Gaofang (raindy)%n%n e-mail: [Email protected]%n%n


Note:%n is a line break in the Inno script

7. After the installation ends, move the main program or open the file, and so on, just modify the code in the [Run] segment of the Inno script:

Filename: {app}pdfunlocker.exe; Description: Start PDF Unlocker; Flags:nowait Postinstall shellexec;
Filename: {app} Chinese description of. txt; Description: Check the description; Flags:nowait Postinstall shellexec

8. Custom Beveledlabel Text
[Messages]
beveledlabel= Zhongtian VIP Studio
9. The "Install" text in the upper left corner of the custom installer interface
[Message]
setupapptitle= the words needed
setupwindowtitle= the words needed
10. Custom Installer Version number
versioninfoversion=1.1
versioninfotextversion=1.1

Reference Code

1. System process Monitoring

[Code]
Var
Is_value:integer;
function Initializesetup (): Boolean;
Begin
Result: =true;
Is_value:=findwindowbyclassname (' Tfrmcmdcenter ');
While is_value<>0 do
Begin
If Msgbox (' Setup detects that your Thunderbolt software is currently running. ' #13 #13 ' You must close it first and then click Yes to continue the installation, or press No to exit! ', mbconfirmation, mb_yesno) = Idno Then
Begin
Result: =false; Setup exits
Is_value: = 0;
End ELSE begin
Result: =true; The Setup program continues
Is_value:=findwindowbyclassname (' Tfrmcmdcenter ');
End
End
End

function Initializeuninstall (): Boolean;
Begin
Is_value:=findwindowbyclassname (' Tfrmcmdcenter ');
If Is_value<>0 then BEGIN
MsgBox (' Uninstall program ' detects that your Thunderbolt software is currently running. ' #13 #13 ' for a more secure and complete uninstallation, you must turn it off during the uninstall operation! ', Mberror, MB_OK);
Result: =false;
End else Result: =true;
End

2. Customize the top right corner of the installer picture size
[Code]
Procedure Initializewizard ();
Begin
wizardform.wizardsmallbitmapimage.width:=150; Set the size of the header picture
wizardform.wizardsmallbitmapimage.left:=wizardform.width-150; Set the gap left by the page header
wizardform.pagenamelabel.width:=0; Set the size of the caption text display
wizardform.pagedescriptionlabel.width:=0; Set the size of the caption text display
End

3. The Welcome screen of the hop-off Setup program
Inno's design itself can skip all the wizard pages (with the Shouldskippage function), but only can not skip the Welcome page, it is said that the author is intended to prevent the misuse of this feature, that is, the creation of completely no interface in the background to run the installation program.
To skip the Welcome page, you can only invoke the functionality of the system.

Refer to a
Copy content to Clipboard code:
[Code]
Const
Wm_lbuttondown = 513;
Wm_lbuttonup = 514;

Procedure Initializewizard ();
Begin
PostMessage (wizardform.nextbutton.handle,wm_lbuttondown,0,0);
PostMessage (wizardform.nextbutton.handle,wm_lbuttonup,0,0);
Other code
End
Reference two
Copy content to Clipboard code:
[Code]
Procedure curpagechanged (Curpageid:integer);
Begin
If Curpageid = Wpwelcome Then
WizardForm.NextButton.OnClick (Wizardform);
End
Both can skip the Welcome page

4. Skip the Ready to install interface
Using Inno Packaging, we will notice that after selecting all the items specified by the Installation Wizard, the Installation Wizard will go to a ready to install interface to prompt you for all installation information. At this point, we can only click the Install button to install to continue. Sometimes, for some reason, we might not want the program to show the installation interface, so how do we get rid of it? Take a look at the following code:
[Code]
function Shouldskippage (Pageid:integer): Boolean;
Begin
If Pageid=wpready Then
Result: = true;
End

5. Determine the existence of the Registry check procedure
Sometimes, we make the software of the Chinese or patches, we need to determine whether the software is installed, if the software has been installed to install the patch, if the software is not installed to terminate the installation program and prompt users to install the original software before running the patch, then how to implement this function, here to provide you with a judge of my strength. By checking the registry key values to determine whether the specified program is installed, the following is a program I made an enhancement patch, need to install on the basis of the source program, the specific script is judged as follows:
[CODE]
Var
Mykeyexist:boolean;

function Initializesetup (): boolean;
Begin
mykeyexist:= true;
If not regvalueexists (HKEY_LOCAL_MACHINE, ' SOFTWAREAdobeAudition3.0 ', ' Applicationpath ') then
Begin
Mykeyexist:= false;
MsgBox (' Setup has detected that Adobe Audition3.0 is not installed in your system, please install the software before running this patch. ', mbinformation, MB_OK);
End
Result:= mykeyexist;
End

6. How to make the Agreement permission page by default Select the I agree button
In order to make it easier for beginners to install the software, sometimes we will find that some of the programs that use Inno Setup are already selected by default on the license page, I agree button, just click Next to continue the installation, then how this effect is achieved? Here's the code:
[Code]
Procedure Initializewizard ();
Begin
WizardForm.LICENSEACCEPTEDRADIO.Checked: = true;
End

7. Pre-installation detection is installed
function Initializesetup (): boolean;
Begin
Result: = true;
If FileExists (Expandconstant (' {PF} my program my program. exe ')) then
Begin
MsgBox (' The program is already installed in your system, please uninstall first! ', mbinformation, MB_OK);
Result: = false;
End
End
where {PF} my programs my program. EXE is replaced by your own path
The implication of adding this code is to detect whether the directory contains the file name specified in the code files, if there is a direct pop-up prompt after you run the program to tell you that the software already exists, please uninstall first. Therefore, this code has a limitation, is to detect only fixed directory files, if the user's files are not installed in the script specified by the detection directory, then it will not be detected. As a result, judgment fails.


8. Display new features after installation is complete
[Run]
Filename: "{app}whatsnew.txt"; Description: "Show new features after installation is complete"; Flags:postinstall shellexec skipifsilent

9, silent installation Vcredist_x86.exe
[Run]
Filename: {app}vcredist_x86.exe; Parameters:/q; Workingdir: {tmp}; Flags:skipifdoesntexist; Statusmsg: "Installing Microsoft Visual C + + Runtime ..."; Check:needinstallvc9sp1

[Code]
Var
Vc9sp1missing:boolean;

function Needinstallvc9sp1 (): Boolean;
Begin
Result: = vc9sp1missing;
End

function Initializesetup (): Boolean;
Var
version:cardinal;
Begin
If Regquerydwordvalue (HKLM, ' softwaremicrosoftwindowscurrentversionuninstall{ 9a25302d-30c0-39d9-bd6f-21e6ec160475} ', ' Version ', version) = False
Then
Begin
Vc9sp1missing: = true;
End
Result: = true;
End

Inno Setup to make the installation package

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.