使用Innosetup制作安装包的一些技巧
1. 选择安装界面上的图片
- [Setup]
- ;设置界面上的两个图片
- WizardImageFile=WizModernImage.bmp
- WizardSmallImageFile=WizSmallImage.bmp
2. 设置安装界面上的文字
- [Messages]
- ;设置开始界面
- WelcomeLabel1=%n欢迎安装 MyProgram开发系统
- WelcomeLabel2=%n集MyProgram于一体的开发平台%n%n-单机版:用于开发MyProgram功能平台%n%n-网络版:用于开发MyProgram功能平台%n%n%n%n%n
- ;设置许可证协议界面
- WizardLicense=许可证协议
- LicenseLabel=在安装“MyProgram开发系统”之前,请阅读%n授权协议
- ;设置安装路径选择界面
- WizardSelectDir=选择安装位置
- SelectDirDesc=选择“MyProgram开发系统”的安装文件夹
- SelectDirLabel3=-安装程序将安装 MyProgram开发系统 到下列文件夹%n%n-要安装到其他文件夹,单机[浏览(b)...]按钮并选择其他文件夹%n%n-点击[< 返回(B)]按钮返回上一个界面%n%n-选择[继续(N) >]按钮继续安装 MyProgram开发系统%n%n-选择[取消]按钮退出 MyProgram开发系统 安装
- SelectDirBrowseLabel=
- DiskSpaceMBLabel=
- ;设置组件安装界面
- WizardSelectComponents=选择组件
- SelectComponentsDesc=选择您想要安装的 MyProgram开发系统 的组件
- SelectComponentsLabel2=请选择您要安装的组件,清除您不想安装的组件。%n点击[继续(N) >]按钮继续。
- ;设置准备安装界面
- WizardReady=准备安装
- ReadyLabel1=安装程序将安装 MyProgram开发系统
3. 设置安装界面上的组件
- [Types]
- ;设置组件的两种状态,完全安装与用户自定义安装
- Name: "custom"; Description: "用户自定义安装"; Flags: iscustom
- Name: "full"; Description: "完全安装"
- [Components]
- ;默认为选择状态
- Name: "demo1"; Description: "demo1"; Types: full custom; Flags: fixed;
- ;默认为不选择状态,完全安装时为选择状态
- Name: "demo2"; Description: "demo2"; Types: full;
- ;默认为不选择状态
- Name: "demo3"; Description: "demo3"; Types: full;
4. 设置安装界面右上角图片大小及位置
- Var
- PageName, PageDescription: TLabel;
{设置安装界面右上角图片大小及位置}
- procedure InitializeWizard();
- begin
- {WizardForm.WizardSmallBitmapImage.width := 100;
- WizardForm.WizardSmallBitmapImage.left := WizardForm.width - 100;
- WizardForm.WizardSmallBitmapImage.height := 50;
- WizardForm.PAGENAMELABEL.width:=100;
- WizardForm.PAGEDESCRIPTIONLABEL.width:=200;}
- PageName := TLabel.Create(WizardForm.MainPanel);
- PageName.Parent := WizardForm.MainPanel;
- PageName.Top := WizardForm.PageNameLabel.Top;
- PageName.Left := WizardForm.PageNameLabel.Left;
- PageName.Width := WizardForm.PageNameLabel.Width;
- PageName.Height := WizardForm.PageNameLabel.Height;
- PageName.Font := WizardForm.PageNameLabel.Font;
- PageName.Transparent := true;
- PageName.Font.Color:=clblack;
- PageDescription := TLabel.Create(WizardForm.MainPanel);
- PageDescription.Parent := WizardForm.MainPanel;
- PageDescription.Top := WizardForm.PageDescriptionLabel.Top;
- PageDescription.Left := WizardForm.PageDescriptionLabel.Left;
- PageDescription.Width := WizardForm.PageDescriptionLabel.Width;
- PageDescription.Height := WizardForm.PageDescriptionLabel.Height;
- PageDescription.Font := WizardForm.PageDescriptionLabel.Font;
- PageDescription.Transparent := true;
- PageDescription.Font.Color:=clblack;
- WizardForm.WizardSmallBitmapImage.Top := ScaleY(0);
- WizardForm.WizardSmallBitmapImage.Left := ScaleX(0);
- WizardForm.WizardSmallBitmapImage.Width := WizardForm.MainPanel.Width;
- WizardForm.WizardSmallBitmapImage.Height := WizardForm.MainPanel.Height;
- WizardForm.PageNameLabel.Visible := false;
- WizardForm.PageDescriptionLabel.Visible := false;
- end;
- procedure CurPageChanged(CurPageID: Integer);
- begin
- PageName.Caption := WizardForm.PageNameLabel.Caption;
- PageDescription.Caption := WizardForm.PageDescriptionLabel.Caption;
- PageDescription.width:=300;
- end;
5. 定义[Message]段颜色
- procedure InitializeWizard();
- begin
- WizardForm.BeveledLabel.Enabled:= True;
- WizardForm.BeveledLabel.Font.Color:= clblue;
- end;
6. 安装、卸载时判断是否程序正在运行,卸载完成时自动打开网页
- var
- ErrorCode: Integer;
- IsRunning: Integer;
- // 安装时判断客户端是否正在运行
- function InitializeSetup(): Boolean;
- begin
- Result :=true; //安装程序继续
- IsRunning:=FindWindowByWindowName('东方宽频网络电视');
- while IsRunning0 do
- begin
- if Msgbox('安装程序检测到客户端正在运行。' #13#13 '您必须先关闭它然后单击“是”继续安装,或按“否”退出!', mbConfirmation, MB_YESNO) = idNOthen
- begin
- Result :=false; //安装程序退出
- IsRunning :=0;
- end else begin
- Result :=true; //安装程序继续
- IsRunning:=FindWindowByWindowName('东方宽频网络电视');
- end;
- end;
- end;
- // 卸载时判断客户端是否正在运行
- function InitializeUninstall(): Boolean;
- begin
- Result :=true; //安装程序继续
- IsRunning:=FindWindowByWindowName('东方宽频网络电视');
- while IsRunning0 do
- begin
- if Msgbox('安装程序检测到客户端正在运行。' #13#13 '您必须先关闭它然后单击“是”继续安装,或按“否”退出!', mbConfirmation, MB_YESNO) = idNOthen
- begin
- Result :=false; //安装程序退出
- IsRunning :=0;
- end else begin
- Result :=true; //安装程序继续
- IsRunning:=FindWindowByWindowName('东方宽频网络电视');
- end;
- end;
- end;
- procedure CurUninstallStepChanged(CurUninstallStep:TUninstallStep);
- begin
- case CurUninstallStep of
- usUninstall:
- begin // 开始卸载
- end;
- usPostUninstall:
- begin //卸载完成
- // MsgBox('CurUninstallStepChanged:'#13#13 'Uninstall just finished.', mbInformation, MB_OK);
- // ...insert code to performpost-uninstall tasks here...
- ShellExec('open','http://www.dreams8.com', '', '', SW_SHOWNORMAL, ewNoWait,ErrorCode);
- end;
- end;
- end;
7. 去掉安装程序左上角“关于安装程序”的代码
- procedureInitializeWizard();
- begin
- WizardForm.BorderIcons:= [biMinimize];
- end;
- procedure CurPageChanged(CurPage: Integer);
- begin
- if CurPage=wpWelcome then
- WizardForm.BorderIcons:= [biSystemMenu, biMinimize];
- end;
- 或者
- procedure InitializeWizard();
- begin
- WizardForm.BORDERICONS := [biHelp, biSystemMenu, biMinimize];
- end;
8. 添加“关于”和网站链接按钮
- procedure URLLabelOnClick(Sender: TObject);
- var
- ErrorCode: Integer;
- begin
- ShellExec('open', 'http://www.vistaqq.com', '', '', SW_SHOWNORMAL, ewNoWait,ErrorCode);
- end;
- procedure AboutButtonOnClick(Sender: TObject);
- begin
- MsgBox(#13 'Vista 状态条风格盘符' #13 #13'本软件由jinn制作,希望各位登陆中天VIP工作室!' #13#13 '版权所有 (C) 中天VIP工作室', mbInformation, MB_OK);
- end;
- var
- AboutButton, CancelButton: TButton;
- URLLabel: TNewStaticText;
- procedure InitializeWizard();
- begin
- { Create the pages }
- WizardForm.PAGENAMELABEL.Font.Color:= clred;
- WizardForm.PAGEDESCRIPTIONLABEL.Font.Color:= clBlue;
- WizardForm.WELCOMELABEL1.Font.Color:= clGreen;
- WizardForm.WELCOMELABEL2.Font.Color:= clblack;
- CancelButton := WizardForm.CancelButton;
- AboutButton := TButton.Create(WizardForm);
- AboutButton.Left := WizardForm.ClientWidth -CancelButton.Left - CancelButton.Width;
- AboutButton.Top := CancelButton.Top;
- AboutButton.Width := CancelButton.Width;
- AboutButton.Height := CancelButton.Height;
- AboutButton.Caption := '&About';
- AboutButton.OnClick := @AboutButtonOnClick;
- AboutButton.Parent := WizardForm;
- URLLabel := TNewStaticText.Create(WizardForm);
- URLLabel.Caption := '中天VIP工作室';
- URLLabel.Cursor := crHand;
- URLLabel.OnClick := @URLLabelOnClick;
- URLLabel.Parent := WizardForm;
- { Alter Font *after* setting Parent so the correctdefaults are inherited first }
- URLLabel.Font.Style := URLLabel.Font.Style +[fsUnderline];
- URLLabel.Font.Color := clBlue;
- URLLabel.Top := AboutButton.Top + AboutButton.Height -URLLabel.Height - 2;
- URLLabel.Left := AboutButton.Left + AboutButton.Width +ScaleX(20);
- end;
9. 安装时播放音乐
在脚本编译里的[Code]与[Files]段处添加以下代码:
- Function mciSendString(lpszCommand: String; lpszReturnString: Integer;cchReturnLength: Integer; hwndCallback: Integer): Integer;
- external 'mciSendStringA@winmm.dll stdcall';
- procedure InitializeWizard();
- var
- BGMusicFile, SplashFile: string;
- SplashForm: TForm;
- SplashFileName: String;
- I: Integer;
- begin
- ExtractTemporaryFile(ExtractFileName(ExpandConstant('{tmp}\music.mp3')));
- SplashForm := TForm.create(nil);
- with SplashForm do
- begin
- mciSendString(ExpandConstant('play {tmp}\music.mp3'),0,0,0);
- Close;
- Free;
- end;
- end;
- [Files]
- Source: "C:\music.mp3"; Flags: dontcopy
或者
- Source: "C:\mymusic.mp3";DestDir: "{tmp}"; Flags: dontcopy
代码说明:[Code]中蓝色代码{tmp}与\music.mp3的意思是播放inno setup安装时创建的临时文件夹内的music.mp3音乐文件!
[Files]中C:\music.mp3是你音乐源文件的地址,填自己的音频名称与音频格式。Flags: dontcopy 的意思是在安装时将音乐文件放到Inno Setup所创建的临时文件夹内,并且在完成安装后删除此音乐文件
10. 关于Inno Setup安装欢迎界面文字与安装向导文字颜色修改
- procedure InitializeWizard();
- begin
- //改变欢迎页面文字的颜色 (如图)
- WizardForm.WelcomeLabel1.Font.Color:= clNavy;
- WizardForm.WelcomeLabel2.Font.Color:= clTeal;
- end;
使用Innosetup制作安装包的一些技巧的更多相关文章
- 循序渐进做项目系列(5):制作安装包,谁人都可以!——VS制作安装包简明教程
一开始让我做安装包的时候,其实我是拒绝的.因为我根本就不会做安装包.查了资料之后,我很懵,很晕,很乱,因为不清晰,不简明,不直白.然而经过一番彷徨的挣扎,我终于发现:制作安装包,谁人都可以!故挥狼毫, ...
- 使用Qt installer framework制作安装包
一.介绍 使用Qt库开发的应用程序,一般有两种发布方式:(1)静态编译发布.这种方式使得程序在编译的时候会将Qt核心库全部编译到一个可执行文件中.其优势是简单单一,所有的依赖库都集中在一起,其缺点也很 ...
- 【原创】VB6.0应用程序安装包的生成(Setup Factory 9.0制作安装包的方法)
VB6.0应用程序安装包的生成,利用其自带的打包工具生成的安装程序很简陋,一点不美观:如果想让自己的应用程序安装的时候显得高大上一点,本教程提供使用Setup Factory 9.0制作安装包的方法. ...
- VS 制作安装包小窥
难得忙里偷闲,看到有关VS制作安装包,按下文小试一把,还行,比不上Installshield. 首先在打开 VS2010 > 文件 >新建项目 创建一个安装项目 XXX 在“目 ...
- vs2015 制作安装包额外需要安装的软件VSI_bundle
vs2015 制作安装包额外需要安装的软件VSI_bundle 下载地址:http://files.cnblogs.com/files/sdner/VSI_bundle.rar
- Wix制作安装包
Wix制作安装包,找起资料来很费劲,记录一下: Product.wxs,该文件只能制作出msi形式的安装包,不能做到自动检测framework. <?xml version="1.0& ...
- [转载]如何用Visual Studio制作安装包
原文地址:如何用Visual Studio制作安装包作者:蓝羽幽游 环境:Microsoft Visual Studio 2010 语言:C# 构架:.NET Framework 2.0 解决方案名称 ...
- VS vs2012制作安装包
VS vs2012制作安装包 一.参考地址: http://www.3fwork.com/b100/000196MYM014103/
- 为自己编写的windows应用程序制作安装包
1 写好了一个windows程序之后如何制作安装包 这个在vs中就可以直接发布了,可以制作msi的安装包和exe的安装包. 2 window应用程序安装包做了哪些事情 rpm安装包的话,只是把相应的文 ...
随机推荐
- Toolkit.getImage获取图片
public class Img { private static final Toolkit tk = Toolkit.getDefaultToolkit(); public static fina ...
- 【NOIP2005】过河
感觉这题好玄--最后看了chty的代码才过,我现在这样必须看题解才能A题怎么办嘛qaq 原题: 在河上有一座独木桥,一只青蛙想沿着独木桥从河的一侧跳到另一侧.在桥上有一些石子,青蛙很讨厌踩在这些石子上 ...
- 黑马程序员——JAVA基础之File类,递归,打印流,合并切割流
------- android培训.java培训.期待与您交流! ---------- File类 用来将文件或者文件夹封装成对象 方便对文件与文件夹的属性信息进行操作. File对象可以作为参数传递 ...
- android视频播放器开发
http://blog.csdn.net/u010181592/article/details/49301703 http://blog.csdn.net/qq_33291295/article/de ...
- SocketTcpClient
public class SocketTcpClient { public static string ErrorMsg = string.Empty; private static Socket _ ...
- php接口和抽象类
接口关键字:interface,不加class关键字接口里面有成员方法,但是没有函数体.实现接口使用的关键字:implements 不是extends子类必须实现接口的所有方法 使用接口,你可以指定某 ...
- DBMS_JOBS
http://blog.itpub.net/23055736/viewspace-1115938/
- CodeVS 数轴染色
#include<cstdio> #include<algorithm> using namespace std; #define lson rt<<1 #defi ...
- Python基础篇【第1篇】: Python基础
Python 简介 Python 是一个高层次的结合了解释性.编译性.互动性和面向对象的脚本语言. Python 的设计具有很强的可读性,相比其他语言经常使用英文关键字,其他语言的一些标点符号,它具有 ...
- Android 常见问题收集 (持续更新)
gridview中设置item的高度. 一.BaseAdapter中的getView中设置 AbsListView.LayoutParams param = new AbsListView.Layou ...