Inno Setup tutorial-FAQs

Source: Internet
Author: User
Function

* Translate the Inno Setup text
* Does it support MBCS (Multi-Byte Character Set?
* Will Windows Installer be supported in the future?
* How do I change the setup.exe icon?
* You can use Inno Setup to create a conditional installation.Program-For example, if a registry key or file exists only?
* Where is the "Network installation" function?
* Can I create a background installer without using the/silent or/verysilent command line parameters?
* Can the installer use the read registry value as the default installation directory?

Problem

* The Compiler says "parameter quotation marks are mismatched or improperly placed"
* Some files of my application cannot be found when you double-click the shortcut created by the installer. You can double-click the EXE file of the application in the resource manager.
* If the old version is not uninstalled, I install the new version of the application. Two entries are displayed in the Add/delete programs on the control panel.
* Why is the error message "installer file damaged" displayed in some systems "?
* The installer provides a message "cannot register dll/OCX: dllregisterserver output not found"
* After the program is uninstalled, the directory created by the installer still exists.
* I am running a batch file in the [run] segment, but the window remains on the screen after the execution is complete. I want it to "close at exit ".
* I have changed defaultdirname in the script, but the default value is the previous directory when I run the installer.
* I have two [icons] entries with the same name, but only one is installed.
* Installation does not wait for the entry in the [run] section of the program to complete execution.
* Some languages are lost or cannot be displayed in the Select language dialog box.

Installation task

* Create an Internet (URL) shortcut
* Create a shortcut in the quick run Column
* Set the "Start position" object in the shortcut
* Create a file association
* Set Environment Variables
* Close when MS-DOS shortcuts are set
* Make a backup before replacing the file
* Install different files based on the Windows version.
* Set file, directory, or Registry Key License
* Some Inno Setup functions are required for my installer.

How to install ...?

* Ocx file
* Visual Basic System Files
* Visual c ++ system files (such as MFC)
* Comctl32.dll
* BDE (borland database engine)
* MDAC, ADO, and Jet

Compatibility

* Operating system compatibility
* Windows NT/2000/XP Administrator privilege

Miscellaneous

* How many file restrictions does the installation program have?
* What happens after you click "cancel" during installation?

Function
Translate Inno Setup text

Translation of Inno Setup text to other languages does not need to be modifiedSource code. Just make a copy of the default. isl file (including Inno Setup) and edit the text. (Do not directly edit the default. isl file. Otherwise, your changes will be lost after the new version of Inno Setup is installed .) Check the "[messages] section" in the Inno Setup Help file to get some important tips.

Once you complete the editing of the new. isl file, create an entry in the [ages] section to inform the editor that you want to use it:

[Ages]
Name: mytrans; messagesfile: "Compiler: mytranslation. isl"

If you use Inno Setup earlier than 4.0, replace it with the following:

[Setup]
Messagesfile = Compiler: mytranslation. isl

There are many other translation available on the following webpage: Inno Setup third-party file page, and a program that can edit the. isl file.

Does it support MBCS (Multi-Byte Character Set?

Inno Setup 2.0.6 added comprehensive MBCS support. Header byte check is used for parsing all file names and constants. Therefore, errors such as the use of reverse box characters ("\") or parentheses ("{") should not occur.

2.0.6 and earlier versions do not include any special support for MBCS.

Will Windows Installer be supported in the future?

Now I have no plans to write the Windows Installer version of Inno Setup. "Supporting" Windows Installer does not seem to have a perfect writer-I am not interested in doing anything.

How do I change the setup.exe icon?

You can change the installer icon by setting the setupiconfile in the [setup] section. To set the uninstaller icon, set uninstalliconfile.

Can I use Inno Setup to create a qualified installer? For example, if only a registry key or file exists?

Inno Setup 4 added support for this new Pascal script feature.

Note: In earlier versions of Inno Setup, different files are installed based on windows.

Where is the "Network installation" function?

No. I have not added this feature to the version written this time.

Can I create a background installer without using the/silent or/verysilent command line parameters?

No, and you do not want to add such a feature (it will be abused ). If you want to minimize user interaction, use the disable [setup] section directive.

Can the installer use the read registry value as the default installation directory?

Yes. Use a {REG:...} constant in defaultdirname. For example:

[Setup]
Defaultdirname = {REG: HKLM \ SOFTWARE \ my program, path | {pf} \ My program}

For more information about {REG:...} constants, see the "constant" topic in the Inno Setup Help file.

Problem
The compiler says "parameter quotation marks are mismatched or improperly placed"

This message is displayed if you try to embed a quotation mark (") character in a parameter data but it is incomplete (only one. In the Inno Setup Help topic, refer to "parameters in segments" for more information.

When you double-click the shortcut created by the installer, some files of my application cannot be found. You can double-click the EXE file of the application in the resource manager.

Your application may not specify the path name of the file to be opened, so it is searched in the current directory. By default, Inno Setup does not set the "Start position" object in the shortcut it creates. This will cause Windows to pick up its own directory, which is usually not a directory containing your application.

In fact, in all cases, this is something at the same layer of the application that should be created. Normally designed GUI applications should not be expected to start from a special directory; they should always specify the full path name for opening the file. In Delphi or C ++ builder, for example, it can obtain the complete path name containing the application EXE through the following call: extractfilepath (paramstr (0 )). To obtain the complete path named 'file.txt 'in the application directory, use: extractfilepath (paramstr (0) + 'file.txt '.

If you cannot fix this issue in the application layer for some reason, you can add "workingdir: {app} "tells Inno Setup to set the" Start position "object.

Why is the error message "installer file damaged" displayed in some systems "?

This error message is displayed when the size of a file (such as setup.exe and setup.1) belonging to the installer is incorrect, or when some file CRC verification fails. It is not displayed for any reason.

If your installer is distributed over the Internet and there are many error reports when it is obtained, it may be because your network server fails to deliver some file errors.

If your installer is distributed via a CD-ROM or floppy disk, the CD-ROM or floppy disk may be broken, or the device has problems.

When the old version is not uninstalled, I install the new version of the application. Two entries are displayed in the Add/delete programs on the control panel.

This occurs when you change the appid version, or if you do not specify the appid and appname .. If you do this, the installer does not know the two versions of the same application, so a new entry will be created in the Add/delete program. At the same time, a new unmount record file (unins ???. Dat ). The best way is to change the appid and appname.

If you must change the appname in the new version, set the value of appid or appname in the previous version of appid.

The installer provides a message "cannot register dll/OCX: dllregisterserver output not found"

This message usually means that you have specified the "regserver" mark in the file, but it cannot be registered. Deleting the "regserver" mark from the [files] entry will not cause this message.

After the program is uninstalled, the directory created by the installer still exists.

There are several reasons why the directory is not deleted:

* The directory already exists before installation. By default, uninstall programs. For security reasons, do not delete directories not created by the installation program.
* It contains files or subdirectories. If you need to uninstall the program to delete other files/directories, use [uninstalldelete]
* Another process is running in the current directory.

Note: In an Inno Setup 2.0.1 version, the directory must be specified in [dirs] or [uninstalldelete] To be deleted by the unmounted program. In the new Inno Setup version, directories created using the [files] segment entries will be automatically deleted by the unmounted Program (if it is not created using the previous installer ).

I run a batch file in the [run] segment, but the window remains on the screen after the execution is complete. I want it to "close at exit ". "

From Tim rude:
Simply enable the batch processing file to automatically close after exiting. Use the CLS command to clear the screen at the end.

--- Batch processing file 1 ---

@ Echo off
Echo Hello World
Echo the batch processing file is not closed upon exit

--- Batch file 2 ---

@ Echo off
Echo Hello World
Echo: this batch processing file is closed upon exit
CLS

I have changed defaultdirname in the script, but the default value is the previous directory when I run the installer.

When you start the installer, it is found in the registry that if the same application has been installed before, it will use the previously installed directory as the default directory provided to the user in the installation wizard. If you uninstall the application and then run the installer, it uses the new defaultdirname setting. If you want to disable this function, set usepreviusappdir to "no ".

I have two [icons] entries with the same name, but only one is installed.

The two files cannot have the same name, and the shortcut is actually a file. Therefore, the two shortcuts cannot have the same name.

Installation does not wait until the entry of the [run] program is completed.

First, make sure that you do not use the "Nowait" or "waituntisponle" mark in the [run] entry. These tags prevent the installer from waiting until the process ends.

If you do not use these tags, but it still does not seem to wait for the program to complete, then it is very likely that the EXE you are running separates other processes and you will not be able to directly terminate it with itself, as a result, the installer considers that the program has been completed. It is now known that the old InstallShield-based installer will occasionally occur (to work around it, try to use/SMS switch ).

A simple check method: if the program runs "Start/Wait programname.exe" from the command line, it will be checked when the command prompt is returned before the program exits.

Some languages are lost in the select installer language dialog box, or not all are displayed.

Starting from Inno Setup 4.2.2, ages specified in the [ages] section that cannot be displayed under the active windows ANSICodeThe language specified in the [languages] section that cannot be displayed on the page is not listed in the Select language dialog box. For example, Russian is only displayed when the active code page is 1251. If the user is not running on code page 1251, they cannot see the Russian option in the options.

In Windows XP, you can change the active code page in the area and language options of the control panel, set a non-Unicode programming language in the Advanced tab, and click Set default ....

If you can save that you are running in the correct code page and the language is still not listed, it is likely that the languageid setting in the. isl language file is incorrect.

If you want to make all languages visible forcibly, do not consider whether they can be correctly displayed under the active code page in use. Add the following content to the script:

[Langoptions]
Required agecodepage = 0

Installation task
Create an Internet (URL) shortcut

First create a file name, such as "website. url", and then write these lines inside:

[Internetshortcut]
Url = http://web.site.address/

Then add the following lines to your script:

[Files]
Source: "website. url"; destdir: "{app }"

[Icons]
Name: "{group} \ Access my website"; filename: "{app} \ website. url"

Create a shortcut in the quick run Column

Upgrade to at least Inno Setup 1.3.11 and use:

[Icons]
Name: "{userappdata} \ Microsoft \ Internet Explorer \ Quick Launch \ My program"; filename: "{app} \ myprog.exe"

Set the "Start position" object in the shortcut

Use a workingdir parameter in the [icons] segment.

Create File Association

Set the [setup] section to indicate that "changesassociations" is "yes ". Create a [registry] entry according to the following information.

[Registry]
Root: hkcr; subkey: ". myp"; valuetype: string; valuename: ""; valuedata: "myprogramfile"; flags: uninsdeletevalue

". Myp" is the extension to be associated. "Myprogramfile" is the internal name of the file type stored in the registry. Make sure that you use a unique name so that you do not accidentally overwrite the registry key of other applications.

Root: hkcr; subkey: "myprogramfile"; valuetype: string; valuename: ""; valuedata: "My program file"; flags: uninsdeletekey

"My program file" is the name of the file type displayed in the resource manager.

Root: hkcr; subkey: "myprogramfile \ defaulticon"; valuetype: string; valuename: ""; valuedata: "{app} \ myprog. EXE, 0"

Defaulticon is the registry key that specifies the icon contained in the file name associated with the file type. ", 0" tells the resource manager to use the first icon index in myprog. EXE. (", 1" indicates the index of the second icon .)

Root: hkcr; subkey: "myprogramfile \ shell \ open \ command"; valuetype: string; valuename: ""; valuedata: "" {app} \ myprog. EXE "% 1 """

"Shell \ open \ command" is the registry key of the program that is executed when the resource manager double-clicks the file type. The quotation marks in the command line allow it to correctly process long file names.

Set Environment Variables

In Windows NT/2000/XP, environment variables are stored in the registry with string values, so you can use the [registry] segment for operations. The system width environment variable is located:

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ Environment

The environment variable specified by the user is located:

HKEY_CURRENT_USER \ Environment

In Windows 95/98/Me, You need to modify autoexec. BAT to set environment variables. Inno Setup does not include the built-in functions for setting. You can write a small program and run it in the [run] section to set it. (More information ).

Close when MS-DOS shortcuts are set

Inno Setup 1.3.15 and later support "closeonexit" and "dontcloseonexit" in [icons] segments.

Make a backup before replacing the file

Inno Setup has not yet performed a special backup function, but you can create a file copy before replacement as follows in the [files] section:

Source: "{app} \ myprog.exe"; destdir: "{app} \ backup"; flags: External skipifsourcedoesntexist uninsneveruninstall

Install different files based on Windows

This can be done by using the minversion and/or onlybelowversion parameters in the entry. View the topic of common parameters in the help document for details.

Here is a simple example to illustrate how to install a file to the NT platform (Windows NT/2000/XP) and other files to non-NT platform (Windows 95/98/ME ):

[Files]
Source: "{app} \ winnt2000xp.exe"; destdir: "{app}"; minversion: 0, 1
Source: "{app} \ win9598me.exe"; destdir: "{app}"; minversion: 1, 0

"0" indicates that the installation is never performed; "1" indicates that the installation is performed in any version (for example, version 1.0 or higher ).

Note: The above method is not limited to [files] segments; minversion and onlybelowversion can be used in most segments.

Set file, directory, or Registry Key License

Starting from Inno Setup 4.1.0, the [dirs], [files], and [registry] sections support setting license parameters for directories, files, and registry key licenses.

For more advanced requirements, see setacl.

Some Inno Setup functions are required for my installer.

Check the how-to document to perform the custom function.

How to install ...?
Ocx file

We recommend that you install the ocx file using the following methods.

[Files]
Source: "comctl32.ocx"; destdir: "{sys}"; copymode: alwaysskipifsameorolder; flags: restartreplace sharedfile regserver

Visual Basic System File

See this how-to document.

Visual c ++ system files (such as MFC)

See this how-to document.

Comctl32.dll

If your installer requires an updated version of comctl32.dll, You can instruct the user to download the latest version of comctl32 from Microsoft, or call the comctl32 update from your installer by using the following statement:

[Files]
Source: "50comupd.exe"; destdir: "{TMP }"

[Code]
Function shouldinstallcomctlupdate: Boolean;
VaR
MS, ls: Cardinal;
Begin
// Only install if the existing comctl32.dll is <5.80
Result: = false;
If getversionnumbers (expandconstant ('{sys} \ comctl32.dll'), MS, ls) then
If MS <$00050050 then
Result: = true;
End;

[Run]
Filename: "{TMP} \ 50comupd.exe"; parameters: "/R: N/Q: 1"; check: shouldinstallcomctlupdate

You cannot try to install comctl32.dll directly using the [files] segment; Microsoft does not allow this, and this is dangerous.

BDE (borland database engine)

Check the how-to documentation to install BDE and obtain the 32-bit configuration details using Inno Setup.

MDAC, ADO, and jet.

See this how-to document.

Compatibility
Operating system compatibility

Currently supported platforms include Windows 2000, 4.0, XP, me, and NT.

I am currently using and developing on the Windows 2000 platform, so the compatibility with Windows 2000 is reliable.

When a new primary function is introduced, I usually test it in all supported Windows versions.

The 16-bit version of Inno Setup has been abandoned in version 1.3. Windows NT 3.51 supports discard in version 3.0.

Windows NT/2000/XP Administrator privilege

The typical Inno Setup installer does not require administrator or "superuser" permissions to run in Windows NT/2000/XP. Unless specified below.

Administrator permissions are required in Windows NT/2000/XP:

* In the [setup] section of the script, use "adminprivilegesrequired = yes ". This will cause an error message and interrupt the installation of the installer when a user without administrator permission is installed. (In the default setting, adminprivilegesrequired indicates "no ".)
* Use "restartreplace" in the [files] section ". This function enables Inno Setup to call the movefileex function and try to write it to "HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager ". You must have the Administrator permission to write data to these registries.
* Use the [registry] segment to write any key under HKEY_USERS \. Default. You must have the Administrator permission to write data to these registries.

In Windows 2000/XP, one of the administrator or Super User Permissions is required:

* Use the "regserver" flag in the [files] section. Register a DLL in most cases and write it to hkey_classes_root. Normal users do not have the permission.
* Use "sharedfile" in the [files] section. This tag causes Inno Setup to create/update a value in "HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ shareddlls. Common users are not allowed to write these key values.
* Use the fontinstall parameter in the [files] section.
* Write any key in the [registry] segment under HKEY_LOCAL_MACHINE or hkey_classes_root. Common users are not allowed to write these key values.

Inno Setup itself does not need to be written to the WINNT directory, or any registry key mentioned above.

What is the difference when the installer is installed by a user without administrator permissions?

* The registry key for adding/deleting Control Panel entries is created under HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE. Therefore, only the installed user can view it in the Add/delete program entry.
* The constant "{group}" always points to the current user configuration file and all user configuration files.
* All "{common...}" constants are equivalent to "{user...}" constants.
* This program can be uninstalled by other users. (When the Administrator installs the program, only the administrator can uninstall it .)

Miscellaneous
Are there any restrictions on the size of the installation program?

Http://www.zbedu.net/yuwen/user1/376/archives/2006/5292.html

Inno Setup does not limit the size of files, shortcuts, registry entries in a single installer. However, each entry in the installer script requires a certain amount of memory. For example, each [files] entry requires about 120 bytes of memory.

In Inno Setup 3.x and earlier versions, the installer and a single file cannot exceed 2 GB because it does not use 64-bitAlgorithm. This is already added in Inno Setup 4.

What happens when you click Cancel during installation?

when you click "cancel", the installer starts to reply to the previously created changes in a mode similar to uninstalling the program. Therefore, there will be no other installed programs

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.