inno-setup-code-段常用代码

上传人:ji****81 文档编号:203079030 上传时间:2021-10-19 格式:DOCX 页数:16 大小:25.63KB
返回 下载 相关 举报
inno-setup-code-段常用代码_第1页
第1页 / 共16页
inno-setup-code-段常用代码_第2页
第2页 / 共16页
inno-setup-code-段常用代码_第3页
第3页 / 共16页
inno-setup-code-段常用代码_第4页
第4页 / 共16页
亲,该文档总共16页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《inno-setup-code-段常用代码》由会员分享,可在线阅读,更多相关《inno-setup-code-段常用代码(16页珍藏版)》请在金锄头文库上搜索。

1、inno setup code 段常用代码 1 、如何让协议许可页面默认选中我同意按钮codeprocedure InitializeWizard();beginWizardForm.LICENSEACCEPTEDRADIO.Checked := true;end;2、自定义安装程序右上角图片大小codeprocedure InitializeWizard();beginWizardForm.WizardSmallBitmapImage.width:=150; /设置页眉图片的大小WizardForm.WizardSmallBitmapImage.left:=WizardForm.width-

2、150; /设置左边页眉留出的空隙 WizardForm.PAGENAMELABEL.width:=0; /设置标题文字显示的大小WizardForm.PAGEDESCRIPTIONLABEL.width:=0; /设置标题文字显示的大小end;/ 或者自定义安装向导小图片codeprocedure InitializeWizard();beginWizardform.WizardSmallBitmapImage.left:= WizardForm.width-164; /自定义安装向导小图片显示位置WizardForm.WizardSmallBitmapImage.width:=164; /

3、自定义安装向导小图片宽度Wizardform.PageNameLabel.width:= 495 - 164 -36; /这儿必须定义,数值根据图片宽度更改,显示软件名称的位置Wizardform.PageDescriptionLabel.width:= 495 - 164 -42; /显示页面信息的位置end;3、自定BeveledLabel显示代码codeprocedure InitializeWizard();beginWizardForm.BeveledLabel.Enabled:=true; /允许显示WizardForm.BeveledLabel.Font.Color:=$0005

4、8451; /显示颜色WizardForm.BeveledLabel.Font.Style := WizardForm.BeveledLabel.Font.Style + fsBold; /显示字体WizardForm.BeveledLabel.Left:=5; /显示位置end;4、自定义安装向导图片codeprocedure InitializeWizard();beginWizardform.WELCOMELABEL1.left:= 18; /自定义欢迎页面标题1显示位置Wizardform.WELCOMELABEL2.left:= 18; /自定义欢迎页面标题2显示位置Wizardfo

5、rm.WizardBitmapImage.left:= WizardForm.width-164 /自定义安装向导图片显示位置(显示大小,此处为居右显示)end;5、显示出组件选择框TypesName: full; Description: 推荐Name: default; Description: 典型Name: custom; Description: 自定义; Flags: iscustom;告诉安装程序这个类型是自定义类型。必须定义iscustom这个参数,才能显示出组件选择框6、定义Messages的颜色codeprocedure InitializeWizard();beginWi

6、zardForm.BeveledLabel.Enabled:= True;WizardForm.BeveledLabel.Font.Color:= clblue;end;7、不显示一些特定的安装界面codefunction ShouldSkipPage(PageID: Integer): Boolean;beginif PageID=wpReady thenresult := true;end;wpReady 是准备安装界面PageID查询 INNO帮助中的 Pascal 脚本: 事件函数常量预定义向导页 CurPageID 值wpWelcome, wpLicense, wpPassword,

7、 wpInfoBefore, wpUserInfo, wpSelectDir,wpSelectComponents, wpSelectProgramGroup, wpSelectTasks, wpReady, wpPreparing, wpInstalling, wpInfoAfter, wpFinished8、换行符号在 Messages 换行符号为%n在 MsgBox 中换行符号为 #13#10 /#13 为回车字符9、颜色代码(1)一个值形如 $bbggrr, 这里的 rr, gg 和 bb 指定了两位的亮度值(以十六进制表示)分别为红色,绿色和蓝色。(2)预定义的颜色名称:clBlac

8、k(黑色),clMaroon(暗红),clGreen(绿色),clOlive(橄榄绿),clNavy(深蓝),clPurple(紫色),clTeal(深青),clGray(灰色),clSilver(浅灰),clRed(红色),clLime(浅绿),clYellow(黄色),clBlue(蓝色),clFuchsia(紫红),clAqua(青绿),clWhite(白色)。10、inno代码注释符号; 实例 ; 分号/ 实例 / 双斜杠 多用在code段 实例 大括号 多用在code段注释符号均在英文输入法状态下输入11、在运行卸载程序前显示弹出式消息codefunction InitializeU

9、ninstall(): Boolean;beginif MsgBox(, mbConfirmation, MB_YESNO) = IDYES thenresult:=trueelseresult:=false;end;12、安装、卸载时判断是否程序正在运行,卸载完成时自动打开网页codevarErrorCode: Integer;IsRunning: Integer;/ 安装时判断客户端是否正在运行function InitializeSetup(): Boolean;beginResult :=true; /安装程序继续IsRunning:=FindWindowByWindowName(东方

10、宽频网络电视);while IsRunning0 dobeginif Msgbox(安装程序检测到客户端正在运行。 #13#13 您必须先关闭它然后单击“是”继续安装,或按“否”退出!, mbConfirmation, MB_YESNO) = idNO thenbeginResult :=false; /安装程序退出IsRunning :=0;end else beginResult :=true; /安装程序继续IsRunning:=FindWindowByWindowName(东方宽频网络电视);end;end;end;/ 卸载时判断客户端是否正在运行function Initialize

11、Uninstall(): Boolean;beginResult :=true; /安装程序继续IsRunning:=FindWindowByWindowName(东方宽频网络电视);while IsRunning0 dobeginif Msgbox(安装程序检测到客户端正在运行。 #13#13 您必须先关闭它然后单击“是”继续安装,或按“否”退出!, mbConfirmation, MB_YESNO) = idNO thenbeginResult :=false; /安装程序退出IsRunning :=0;end else beginResult :=true; /安装程序继续IsRunni

12、ng:=FindWindowByWindowName(东方宽频网络电视);end;end;end;procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);begincase CurUninstallStep ofusUninstall:begin / 开始卸载end;usPostUninstall:begin / 卸载完成/ MsgBox(CurUninstallStepChanged: #13#13 Uninstall just finished., mbInformation, MB_OK);/ .insert

13、 code to perform post-uninstall tasks here.ShellExec(open, , , , SW_SHOWNORMAL, ewNoWait, ErrorCode); end;end;end;13、 删除文件和删除文件夹/删除文件 用 DeleteFile 只能删除一个文件,不能使用通配符来删除多个文件DeleteFile(ExpandConstant(appabc.exe);/删除所有文件及文件夹DelTree(ExpandConstant(app), True, True, False);14、BorderStyleTFormBorderStyle =

14、(bsNone, bsSingle, bsSizeable, bsDialog, bsToolWindow, bsSizeToolWin); 无边界式(bsNone) ,单边固定式(bsSingle),双边可变式(bsSizeable),对话框式(bsDialog)15、if elsefunction NextButtonClick(CurPageID: Integer): Boolean;varResultCode: Integer;beginResult := True;if (CurPageID = wpSelectDir) thenbeginMsgBox(AAAA, mbInformation, MB_OK);endelsebeginMsgBox(BBBB, mbInformation, MB_OK);end;end;16、安装结束界面增加“设为首页”选项TasksName: changestartpage; Description: 设置vistaqq为默认主页RegistryRoot: HKCU; Subkey: SoftwareMicrosoftInternet ExplorerMain; ValueType: string; ValueName: Start Page; ValueData: ; tasks: changestartpage

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 工作范文

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号