1. 选择安装界面上的图片

  1. [Setup]
  2. ;设置界面上的两个图片
  3. WizardImageFile=WizModernImage.bmp
  4. WizardSmallImageFile=WizSmallImage.bmp

2. 设置安装界面上的文字

  1. [Messages]
  2. ;设置开始界面
  3. WelcomeLabel1=%n欢迎安装 MyProgram开发系统
  4. WelcomeLabel2=%n集MyProgram于一体的开发平台%n%n-单机版:用于开发MyProgram功能平台%n%n-网络版:用于开发MyProgram功能平台%n%n%n%n%n
  5. ;设置许可证协议界面
  6. WizardLicense=许可证协议
  7. LicenseLabel=在安装“MyProgram开发系统”之前,请阅读%n授权协议
  8. ;设置安装路径选择界面
  9. WizardSelectDir=选择安装位置
  10. SelectDirDesc=选择“MyProgram开发系统”的安装文件夹
  11. SelectDirLabel3=-安装程序将安装 MyProgram开发系统 到下列文件夹%n%n-要安装到其他文件夹,单机[浏览(b)...]按钮并选择其他文件夹%n%n-点击[< 返回(B)]按钮返回上一个界面%n%n-选择[继续(N) >]按钮继续安装 MyProgram开发系统%n%n-选择[取消]按钮退出 MyProgram开发系统 安装
  12. SelectDirBrowseLabel=
  13. DiskSpaceMBLabel=
  14. ;设置组件安装界面
  15. WizardSelectComponents=选择组件
  16. SelectComponentsDesc=选择您想要安装的 MyProgram开发系统 的组件
  17. SelectComponentsLabel2=请选择您要安装的组件,清除您不想安装的组件。%n点击[继续(N) >]按钮继续。
  18. ;设置准备安装界面
  19. WizardReady=准备安装
  20. ReadyLabel1=安装程序将安装 MyProgram开发系统

3. 设置安装界面上的组件

  1. [Types]
  2. ;设置组件的两种状态,完全安装与用户自定义安装
  3. Name: "custom"; Description: "用户自定义安装"; Flags: iscustom
  4. Name: "full"; Description: "完全安装"
  5. [Components]
  6. ;默认为选择状态
  7. Name: "demo1"; Description: "demo1"; Types: full custom; Flags: fixed;
  8. ;默认为不选择状态,完全安装时为选择状态
  9. Name: "demo2"; Description: "demo2"; Types: full;
  10. ;默认为不选择状态
  11. Name: "demo3"; Description: "demo3"; Types: full;

4. 设置安装界面右上角图片大小及位置

  1. Var
  2. PageName, PageDescription: TLabel;

{设置安装界面右上角图片大小及位置}

  1. procedure InitializeWizard();
  2. begin
  3. {WizardForm.WizardSmallBitmapImage.width := 100;
  4. WizardForm.WizardSmallBitmapImage.left := WizardForm.width - 100;
  5. WizardForm.WizardSmallBitmapImage.height := 50;
  6. WizardForm.PAGENAMELABEL.width:=100;
  7. WizardForm.PAGEDESCRIPTIONLABEL.width:=200;}
  8. PageName := TLabel.Create(WizardForm.MainPanel);
  9. PageName.Parent := WizardForm.MainPanel;
  10. PageName.Top := WizardForm.PageNameLabel.Top;
  11. PageName.Left := WizardForm.PageNameLabel.Left;
  12. PageName.Width := WizardForm.PageNameLabel.Width;
  13. PageName.Height := WizardForm.PageNameLabel.Height;
  14. PageName.Font := WizardForm.PageNameLabel.Font;
  15. PageName.Transparent := true;
  16. PageName.Font.Color:=clblack;
  17. PageDescription := TLabel.Create(WizardForm.MainPanel);
  18. PageDescription.Parent := WizardForm.MainPanel;
  19. PageDescription.Top := WizardForm.PageDescriptionLabel.Top;
  20. PageDescription.Left := WizardForm.PageDescriptionLabel.Left;
  21. PageDescription.Width := WizardForm.PageDescriptionLabel.Width;
  22. PageDescription.Height := WizardForm.PageDescriptionLabel.Height;
  23. PageDescription.Font := WizardForm.PageDescriptionLabel.Font;
  24. PageDescription.Transparent := true;
  25. PageDescription.Font.Color:=clblack;
  26. WizardForm.WizardSmallBitmapImage.Top := ScaleY(0);
  27. WizardForm.WizardSmallBitmapImage.Left := ScaleX(0);
  28. WizardForm.WizardSmallBitmapImage.Width := WizardForm.MainPanel.Width;
  29. WizardForm.WizardSmallBitmapImage.Height := WizardForm.MainPanel.Height;
  30. WizardForm.PageNameLabel.Visible := false;
  31. WizardForm.PageDescriptionLabel.Visible := false;
  32. end;
  33. procedure CurPageChanged(CurPageID: Integer);
  34. begin
  35. PageName.Caption := WizardForm.PageNameLabel.Caption;
  36. PageDescription.Caption := WizardForm.PageDescriptionLabel.Caption;
  37. PageDescription.width:=300;
  38. end;

5. 定义[Message]段颜色

  1. procedure InitializeWizard();
  2. begin
  3. WizardForm.BeveledLabel.Enabled:= True;
  4. WizardForm.BeveledLabel.Font.Color:= clblue;
  5. end;

6. 安装、卸载时判断是否程序正在运行,卸载完成时自动打开网页

  1. var
  2. ErrorCode: Integer;
  3. IsRunning: Integer;
  4. // 安装时判断客户端是否正在运行
  5. function InitializeSetup(): Boolean;
  6. begin
  7. Result :=true; //安装程序继续
  8. IsRunning:=FindWindowByWindowName('东方宽频网络电视');
  9. while IsRunning0 do
  10. begin
  11. if Msgbox('安装程序检测到客户端正在运行。' #13#13 '您必须先关闭它然后单击“是”继续安装,或按“否”退出!', mbConfirmation, MB_YESNO) = idNOthen
  12. begin
  13. Result :=false; //安装程序退出
  14. IsRunning :=0;
  15. end else begin
  16. Result :=true; //安装程序继续
  17. IsRunning:=FindWindowByWindowName('东方宽频网络电视');
  18. end;
  19. end;
  20. end;
  21. // 卸载时判断客户端是否正在运行
  22. function InitializeUninstall(): Boolean;
  23. begin
  24. Result :=true; //安装程序继续
  25. IsRunning:=FindWindowByWindowName('东方宽频网络电视');
  26. while IsRunning0 do
  27. begin
  28. if Msgbox('安装程序检测到客户端正在运行。' #13#13 '您必须先关闭它然后单击“是”继续安装,或按“否”退出!', mbConfirmation, MB_YESNO) = idNOthen
  29. begin
  30. Result :=false; //安装程序退出
  31. IsRunning :=0;
  32. end else begin
  33. Result :=true; //安装程序继续
  34. IsRunning:=FindWindowByWindowName('东方宽频网络电视');
  35. end;
  36. end;
  37. end;
  38. procedure CurUninstallStepChanged(CurUninstallStep:TUninstallStep);
  39. begin
  40. case CurUninstallStep of
  41. usUninstall:
  42. begin // 开始卸载
  43. end;
  44. usPostUninstall:
  45. begin      //卸载完成
  46. // MsgBox('CurUninstallStepChanged:'#13#13 'Uninstall just finished.', mbInformation, MB_OK);
  47. // ...insert code to performpost-uninstall tasks here...
  48. ShellExec('open','http://www.dreams8.com', '', '', SW_SHOWNORMAL, ewNoWait,ErrorCode);
  49. end;
  50. end;
  51. end;

7. 去掉安装程序左上角“关于安装程序”的代码

  1. procedureInitializeWizard();
  2. begin
  3. WizardForm.BorderIcons:= [biMinimize];
  4. end;
  5. procedure CurPageChanged(CurPage: Integer);
  6. begin
  7. if CurPage=wpWelcome then
  8. WizardForm.BorderIcons:= [biSystemMenu, biMinimize];
  9. end;
  10. 或者
  11. procedure InitializeWizard();
  12. begin
  13. WizardForm.BORDERICONS := [biHelp, biSystemMenu, biMinimize];
  14. end;

8. 添加“关于”和网站链接按钮

  1. procedure URLLabelOnClick(Sender: TObject);
  2. var
  3. ErrorCode: Integer;
  4. begin
  5. ShellExec('open', 'http://www.vistaqq.com', '', '', SW_SHOWNORMAL, ewNoWait,ErrorCode);
  6. end;
  7. procedure AboutButtonOnClick(Sender: TObject);
  8. begin
  9. MsgBox(#13 'Vista 状态条风格盘符' #13 #13'本软件由jinn制作,希望各位登陆中天VIP工作室!' #13#13 '版权所有 (C) 中天VIP工作室', mbInformation, MB_OK);
  10. end;
  11. var
  12. AboutButton, CancelButton: TButton;
  13. URLLabel: TNewStaticText;
  14. procedure InitializeWizard();
  15. begin
  16. { Create the pages }
  17. WizardForm.PAGENAMELABEL.Font.Color:= clred;
  18. WizardForm.PAGEDESCRIPTIONLABEL.Font.Color:= clBlue;
  19. WizardForm.WELCOMELABEL1.Font.Color:= clGreen;
  20. WizardForm.WELCOMELABEL2.Font.Color:= clblack;
  21. CancelButton := WizardForm.CancelButton;
  22. AboutButton := TButton.Create(WizardForm);
  23. AboutButton.Left := WizardForm.ClientWidth -CancelButton.Left - CancelButton.Width;
  24. AboutButton.Top := CancelButton.Top;
  25. AboutButton.Width := CancelButton.Width;
  26. AboutButton.Height := CancelButton.Height;
  27. AboutButton.Caption := '&About';
  28. AboutButton.OnClick := @AboutButtonOnClick;
  29. AboutButton.Parent := WizardForm;
  30. URLLabel := TNewStaticText.Create(WizardForm);
  31. URLLabel.Caption := '中天VIP工作室';
  32. URLLabel.Cursor := crHand;
  33. URLLabel.OnClick := @URLLabelOnClick;
  34. URLLabel.Parent := WizardForm;
  35. { Alter Font *after* setting Parent so the correctdefaults are inherited first }
  36. URLLabel.Font.Style := URLLabel.Font.Style +[fsUnderline];
  37. URLLabel.Font.Color := clBlue;
  38. URLLabel.Top := AboutButton.Top + AboutButton.Height -URLLabel.Height - 2;
  39. URLLabel.Left := AboutButton.Left + AboutButton.Width +ScaleX(20);
  40. end;

9. 安装时播放音乐

在脚本编译里的[Code]与[Files]段处添加以下代码:

  1. Function mciSendString(lpszCommand: String; lpszReturnString: Integer;cchReturnLength: Integer; hwndCallback: Integer): Integer;
  2. external 'mciSendStringA@winmm.dll stdcall';
  3. procedure InitializeWizard();
  4. var
  5. BGMusicFile, SplashFile: string;
  6. SplashForm: TForm;
  7. SplashFileName: String;
  8. I: Integer;
  9. begin
  10. ExtractTemporaryFile(ExtractFileName(ExpandConstant('{tmp}\music.mp3')));
  11. SplashForm := TForm.create(nil);
  12. with SplashForm do
  13. begin
  14. mciSendString(ExpandConstant('play {tmp}\music.mp3'),0,0,0);
  15. Close;
  16. Free;
  17. end;
  18. end;
  19. [Files]
  20. Source: "C:\music.mp3"; Flags: dontcopy

或者

  1. 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安装欢迎界面文字与安装向导文字颜色修改

    1. procedure InitializeWizard();
    2. begin
    3. //改变欢迎页面文字的颜色 (如图)
    4. WizardForm.WelcomeLabel1.Font.Color:= clNavy;
    5. WizardForm.WelcomeLabel2.Font.Color:= clTeal;
    6. end;

使用Innosetup制作安装包的一些技巧的更多相关文章

  1. 循序渐进做项目系列(5):制作安装包,谁人都可以!——VS制作安装包简明教程

    一开始让我做安装包的时候,其实我是拒绝的.因为我根本就不会做安装包.查了资料之后,我很懵,很晕,很乱,因为不清晰,不简明,不直白.然而经过一番彷徨的挣扎,我终于发现:制作安装包,谁人都可以!故挥狼毫, ...

  2. 使用Qt installer framework制作安装包

    一.介绍 使用Qt库开发的应用程序,一般有两种发布方式:(1)静态编译发布.这种方式使得程序在编译的时候会将Qt核心库全部编译到一个可执行文件中.其优势是简单单一,所有的依赖库都集中在一起,其缺点也很 ...

  3. 【原创】VB6.0应用程序安装包的生成(Setup Factory 9.0制作安装包的方法)

    VB6.0应用程序安装包的生成,利用其自带的打包工具生成的安装程序很简陋,一点不美观:如果想让自己的应用程序安装的时候显得高大上一点,本教程提供使用Setup Factory 9.0制作安装包的方法. ...

  4. VS 制作安装包小窥

    难得忙里偷闲,看到有关VS制作安装包,按下文小试一把,还行,比不上Installshield. 首先在打开 VS2010    >   文件 >新建项目 创建一个安装项目  XXX 在“目 ...

  5. vs2015 制作安装包额外需要安装的软件VSI_bundle

    vs2015 制作安装包额外需要安装的软件VSI_bundle 下载地址:http://files.cnblogs.com/files/sdner/VSI_bundle.rar

  6. Wix制作安装包

    Wix制作安装包,找起资料来很费劲,记录一下: Product.wxs,该文件只能制作出msi形式的安装包,不能做到自动检测framework. <?xml version="1.0& ...

  7. [转载]如何用Visual Studio制作安装包

    原文地址:如何用Visual Studio制作安装包作者:蓝羽幽游 环境:Microsoft Visual Studio 2010 语言:C# 构架:.NET Framework 2.0 解决方案名称 ...

  8. VS vs2012制作安装包

    VS  vs2012制作安装包 一.参考地址: http://www.3fwork.com/b100/000196MYM014103/

  9. 为自己编写的windows应用程序制作安装包

    1 写好了一个windows程序之后如何制作安装包 这个在vs中就可以直接发布了,可以制作msi的安装包和exe的安装包. 2 window应用程序安装包做了哪些事情 rpm安装包的话,只是把相应的文 ...

随机推荐

  1. Python 基础语法(三)

    Python 基础语法(三) --------------------------------------------接 Python 基础语法(二)------------------------- ...

  2. Uncaught TypeError: _react2.default.findDOMNode is not a function

    react 查找某节点时报错 Uncaught TypeError: _react2.default.findDOMNode is not a function 代码: import React, { ...

  3. .net framework 4.0 从 GAC 卸载 程序集

    .net framework 4.0 的 GAC 目录: C:\Windows\Microsoft.NET\assembly\GAC_MSIL 要卸载,仍然使用 gacutil 命令,不要带扩展名: ...

  4. SQL server数据缓存依赖

    SQL server数据缓存依赖有两种实现模式,轮询模式,通知模式. 1  轮询模式实现步骤 此模式需要SQL SERVER 7.0/2000/2005版本以上版本都支持        主要包含以下几 ...

  5. Javascript操作Cookie的脚本 — CookieHelper

    var HttpCookie = function(name, value, expires, path, domain) { if (name) this.Name = name; if (valu ...

  6. Bootstap datetimepicker报错TypeError: intermediate value(转)

    原文转自:http://blog.chinaunix.net/uid-20332519-id-5733546.html Bootstrap datetimepicker有多个版本,官方的链接中,只是d ...

  7. android数据存储之Sqlite(二)

    SQLite学习笔记 前言:上一章我们介绍了sqlite的一些基本知识以及在dos命令下对sqlite进行的增删改查的操作,这一章我们将在android项目中实际来操作sqlite. 1. SQLit ...

  8. POJ-2726-Holiday Hotel

    Holiday Hotel   Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8302   Accepted: 3249 D ...

  9. 使用pt-stalk分析MySQL的性能波动 (转)

    简介 在MySQL服务器出现短暂(5~30秒)的性能波动的时候,一般的性能监控工具都很难抓住故障现场,也就很难收集对应较细粒度的诊断信息.另外,如果这种波动出现的频率很低,例如几天才一次,我们也很难人 ...

  10. Visual Tracker Benchmark

    直接的方法: 首先将代码先拷到benchmark_v1.0/tackers/这个文件夹下,你会发现里面已有好几个算法的代码文件夹了. 这边注意了,我就是这样的,没有注意把代码拷贝进去之后要自己写一个调 ...