选择安装界面上的图片
-
[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','', '', '', 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', '', '', '', 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;
阅读(1449) | 评论(0) | 转发(0) |