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

Source: Internet
Author: User

UsuallyInnoThe icon of the generated installation file is a CD and a display, such. At the same time,ProgramAfter installation, the uninstall program icon in the installation directory is the same. In fact, you can modify it yourself.

 

First generate the installation file icon. This is relatively simple.SetupYou can add the corresponding statement to the 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.UseUpdateicon. dllPlug-ins

3.AddCodeSegment,CodeAs follows:

 

[Code]

//Plug-in function usage

/// parameter : handle ( parent handle of the plug-in error dialog box ), EXE full file path name , (exe file to be replaced ) icon Resource Name , full path name of the icon file , (exe where the icon resource to be replaced is located ) language

//Return Value:Successful= TR,Failed= False

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

External 'updateicon @ files: updateicon. dll stdcall ';

 

//Replace the uninstall program icon

Function updateuninsticon (const icofilename: string): Boolean;

Begin

//TheEXEIf the file path name is left blank, the plug-in will be replaced automatically.InnoUninstall 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::Replace the uninstall program icon, which must be before the uninstall program is generated!

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

If curstep = ssinstall then

Begin

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

Extracttemporaryfile (extractfilename (Sicon ));//Release uninstall icon

//TheEXEIf the file path name is left blank, the plug-in will be replaced automatically.InnoUninstall the program icon!

Updateuninsticon (Sicon );//Replace the uninstall icon

End;

End;

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

 

Installation File

Installation Directory

 

From: http://www.360doc.com/content/13/0327/14/4221543_274246432.shtml

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.