(Switch) Inno Setup entry (14) -- replace the installer and uninstall the program icon

Source: Internet
Author: User
This article is reproduced from: Workshop. 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:

Setupiconfile = jiong. 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.

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 and the script in the agreed directory.

2. Use a plug-in named updateicon. dll

3. 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 = TR, failure = false

Function updateicon (const hwnd: integer; const exefilename, exeicon, icofilename: string; wlangid: DWORD): Boolean;

External '[email protected]: 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!

// The format and size of the installation icon and uninstallation icon are the same. Otherwise, the uninstallation program may fail!

If curstep = ssinstall then

Begin

Sicon: = expandconstant ('{TMP} \ Uninstall. ICO'); // defines the uninstall icon

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!

Updateuninsticon (Sicon); // Replace the unload icon

End;

End;

After compilation, you can. The output file and installed directory are as follows:

Installation File

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.