杉宫竹苑工作室

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2597|回复: 0

Inno setup极点中文脚本

[复制链接]
发表于 2017-2-26 14:20:16 | 显示全部楼层 |阅读模式

正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. ; --------------------------------------------------------------------------------
  2. ; 极点中文输入平台集成版安装脚本
  3. ; ---------------------------------------------------------------------------------

  4. ; 编译器要求: Inno Setup 5 与 ISPP.

  5. ;#define debugmode

  6. ; 最近更新:
  7. #define LastUpdate "2005.03.10"

  8. #define SetupPackMajorVersion "4"
  9. #define SetupPackVersion SetupPackMajorVersion + "." + LastUpdate

  10. #define hasMutex

  11. #define MajorVersion "4"
  12. #define DateVersion ".2.3.8"
  13. #define AppName "极点中文输入平台"
  14. #define AppShortName "极点中文"
  15. #define ReleaseType "4.2正式版"
  16. #define AboutInfo "秋枫 @ [五笔爱好者]"
  17. #define SupportURL "http://www.freewb.net/"

  18. #define SetupPackType "集成版"
  19. #define OutputBase "Freewb.42Final.Deluxe"

  20. ;; 码表宏处理
  21. ;; 下面的一些预处理定义方便增减集成版中的mb组件以减少代码修改
  22. ;; 如需要增减码表只需修改mbcount并增加相应的数组元素
  23. #define i
  24. #define mbcount 6
  25. #dim mbIDArray[mbcount] ;码表的英文唯一标识符,用于脚本内部,不应与其它重复
  26. #dim mbNameArray[mbcount] ;码表中文名称, 也是码表在mb目录下的文件夹名
  27. #dim mbVerArray[mbcount] ;码表版本
  28. #dim mbSizeArray[mbcount] ;码表词条数大小

  29. #expr i=0
  30. #define mbIDArray[i] "add_wozy"
  31. #define mbNameArray[i] "五笔86[窝子极爽词库]"
  32. #define mbVerArray[i] "5.0版"
  33. #define mbSizeArray[i] "约6.0万词"

  34. #expr i++
  35. #define mbIDArray[i] "add_mb86wonderland"
  36. #define mbNameArray[i] "五笔86[奇境简优词库]"
  37. #define mbVerArray[i] "1.3版"
  38. #define mbSizeArray[i] "约1.7万词"

  39. #expr i++
  40. #define mbIDArray[i] "add_mb86jyj"
  41. #define mbNameArray[i] "五笔86[晋一剑词库]"
  42. #define mbVerArray[i] "1.2版"
  43. #define mbSizeArray[i] "约4.2万词"

  44. #expr i++
  45. #define mbIDArray[i] "add_mb86wm"
  46. #define mbNameArray[i] "标准王码86"
  47. #define mbVerArray[i] "原版"
  48. #define mbSizeArray[i] "约1.4万词"

  49. #expr i++
  50. #define mbIDArray[i] "add_mb98"
  51. #define mbNameArray[i] "五笔98[沧海词库]"
  52. #define mbVerArray[i] "SeaLaugh-1.0版"
  53. #define mbSizeArray[i] "约4.5万词"

  54. #expr i++
  55. #define mbIDArray[i] "add_mb2b"
  56. #define mbNameArray[i] "二笔标版"
  57. #define mbVerArray[i] "0425版"
  58. #define mbSizeArray[i] "约5.1万词"

  59. [Setup]
  60. OutputBaseFilename={#OutputBase}.{#SetupPackVersion}

  61. VersionInfoVersion={#SetupPackVersion}
  62. VersionInfoDescri ption={#AppName} {#SetupPackType}
  63. VersionInfoTextVersion=极点内核版本: {#MajorVersion}{#DateVersion}
  64. AppPublisher={#AboutInfo}
  65. AppVersion={#SetupPackVersion}
  66. AppPublisherURL={#SupportURL}
  67. AppContact=秋枫<arcqiufeng@hotmail.com>

  68. #if defined(debugmode)
  69. Compression=none
  70. #else
  71. Compression=lzma/ultra
  72. SolidCompression=true
  73. #endif

  74. AppName={#AppName}
  75. AppVerName={#AppName} {#ReleaseType} {#MajorVersion}{#DateVersion}
  76. DefaultDirName={pf}\freewb
  77. PrivilegesRequired=admin
  78. DefaultGroupName=极点中文
  79. LicenseFile=license.rtf
  80. RestartIfNeededByRun=true
  81. WizardImageFile=side5.bmp
  82. WizardSmallImageFile=WizModernSmallImage10.bmp
  83. WizardImageStretch=true
  84. ShowTasksTreeLines=true
  85. ; AppMutex=mutex_freeime,Global\mutex_freeime
  86. InfoBeforeFile=info.txt
  87. AllowNoIcons=yes

  88. [Files]
  89. ;;; ***** main *****
  90. Source: freewb\*.*; DestDir: {app}; Flags: restartreplace uninsrestartdelete ignoreversion; Components: Main
  91. Source: freewb\freewb.ime; DestDir: {sys}; Flags: restartreplace uninsrestartdelete ignoreversion; Components: Main
  92. Source: freewb\freewb.htm; DestDir: {app}; Flags: isreadme ignoreversion; Components: Main
  93. Source: freewb\skin\*.*; DestDir: {app}\skin; Flags: recursesubdirs restartreplace; Components: Main
  94. Source: freewb\background\*.*; DestDir: {app}\background; Flags: recursesubdirs restartreplace; Components: Main
  95. Source: freewb\Internet Shortcuts\*.*; DestDir: {app}\Internet Shortcuts; Components: Main

  96. ;;; 安装程序中用的图标
  97. Source: freewb\ui_icon\*.*; DestDir: {tmp}; flags: dontcopy

  98. ;;; ***** 码表 *****

  99. ;;; ~~~~~~~ 标准码表
  100. Source: freewb\mb\default\attach.mb; DestDir: {app}\mb\default; Components: Main
  101. Source: freewb\mb\default\freewb.dat; DestDir: {app}\mb\default; Components: Main
  102. Source: freewb\mb\default\freewb.mb; DestDir: {app}\mb\default; Components: Main
  103. Source: freewb\mb\default\freewb.usr; DestDir: {app}\mb\default; Components: Main; Flags: onlyifdoesntexist
  104. Source: freewb\mb\default\freewbcht.mb; DestDir: {app}\mb\default; Components: Main
  105. Source: freewb\mb\default\quick.mb; DestDir: {app}\mb\default; Components: Main
  106. Source: freewb\mb\default\smart.mb; DestDir: {app}\mb\default; Components: Main
  107. Source: freewb\mb\default\user.ini; DestDir: {app}\mb\default; Components: Main

  108. ;;; ~~~~~~~ 扩展码表
  109. #sub AddMbFiles
  110. Source: freewb\add_mb\{#mbNameArray[i]}\attach.mb; DestDir: {app}\mb\{#mbNameArray[i]}; Components: add_mb\{#mbIDArray[i]}; Flags: skipifsourcedoesntexist
  111. Source: freewb\add_mb\{#mbNameArray[i]}\freewb.dat; DestDir: {app}\mb\{#mbNameArray[i]}; Components: add_mb\{#mbIDArray[i]}
  112. Source: freewb\add_mb\{#mbNameArray[i]}\freewb.mb; DestDir: {app}\mb\{#mbNameArray[i]}; Components: add_mb\{#mbIDArray[i]}
  113. Source: freewb\add_mb\{#mbNameArray[i]}\freewb.usr; DestDir: {app}\mb\{#mbNameArray[i]}; Components: add_mb\{#mbIDArray[i]}; Flags: onlyifdoesntexist
  114. Source: freewb\add_mb\{#mbNameArray[i]}\freewbcht.mb; DestDir: {app}\mb\{#mbNameArray[i]}; Components: add_mb\{#mbIDArray[i]}; Flags: skipifsourcedoesntexist
  115. Source: freewb\add_mb\{#mbNameArray[i]}\quick.mb; DestDir: {app}\mb\{#mbNameArray[i]}; Components: add_mb\{#mbIDArray[i]}; Flags: skipifsourcedoesntexist
  116. Source: freewb\add_mb\{#mbNameArray[i]}\smart.mb; DestDir: {app}\mb\{#mbNameArray[i]}; Components: add_mb\{#mbIDArray[i]}; Flags: skipifsourcedoesntexist
  117. Source: freewb\add_mb\{#mbNameArray[i]}\user.ini; DestDir: {app}\mb\{#mbNameArray[i]}; Components: add_mb\{#mbIDArray[i]}; Flags: onlyifdoesntexist
  118. #endsub

  119. #for {i = 0; i < mbcount; i++} AddMbFiles

  120. ;;; ***** 拼音词库 *****
  121. Source: freewb\attach\attach.mb; DestDir: {app}\mb\default; Components: pinyin

  122. #sub AddPymbFiles
  123. Source: freewb\attach\attach.mb; DestDir: {app}\mb\{#mbNameArray[i]}; Components: add_mb\{#mbIDArray[i]} and pinyin
  124. #endsub

  125. #for {i = 0; i < mbcount; i++} AddPymbFiles

  126. ;;; ***** 扩充皮肤与背景图 *****
  127. Source: freewb\add_skin\*.*; DestDir: {app}\skin; Components: add_skin; Flags: recursesubdirs
  128. Source: freewb\add_background\*.*; DestDir: {app}\background; Components: add_skin; Flags: recursesubdirs

  129. ;;; ***** dtool *******
  130. Source: freewb\dtool\dtool.exe; DestDir: {app}\dtool; Flags: restartreplace; Components: dtool

  131. ;;; ***** diy setup *******
  132. Source: freewb\diysetup\Jd_DIY_Setup_Wizard.exe; DestDir: {app}; Flags: ignoreversion; Components: diysetup

  133. ;;; ***** BigPayne’s jdtools *****
  134. Source: freewb\BigPayne\*.*; DestDir: {app}\BigPayne; Components: BigPayne; Flags: ignoreversion

  135. ;;; ***** Silence’s imetools *****
  136. Source: freewb\imetool\*.*; DestDir: {app}\imetool; Components: imetools
  137. Source: freewb\imetool\imetool.exe; DestDir: {sys}; Components: imetools

  138. [Icons]
  139. Name: {group}\极点目录; Filename: {app}
  140. Name: {group}\极点配置文件; Filename: {app}\freewb.ini
  141. Name: {group}\卸载{#AppName}; Filename: {uninstallexe}

  142. Name: {group}\快速入门\极点中文快速入门; Filename: {app}\freewb.htm
  143. Name: {group}\快速入门\快捷键位表; Filename: {app}\Internet shortcuts\ShortcutKeys.url
  144. Name: {group}\快速入门\快捷命令表; Filename: {app}\Internet shortcuts\ShortcutCommands.url
  145. Name: {group}\快速入门\极点常见问题及解答; Filename: {app}\Internet shortcuts\FAQ.url
  146. Name: {group}\快速入门\极点应用技巧; Filename: {app}\Internet shortcuts\Skill.url
  147. Name: {group}\快速入门\极点帮助文档; Filename: {app}\freewb.chm
  148. Name: {group}\链接\访问极点中文主页; Filename: {app}\Internet shortcuts\极点中文主页.url
  149. Name: {group}\链接\访问五笔爱好者论坛; Filename: {app}\Internet shortcuts\五笔爱好者论坛.url

  150. Name: {group}\极点工具箱2.2; Filename: {app}\dtool\dtool.exe; Components: dtool
  151. Name: {group}\输入法调整工具; Filename: {app}\imetool\imetool.exe; WorkingDir: {app}\imetool; Components: imetools
  152. Name: {group}\极点便携定制向导; Filename: {app}\Jd_DIY_Setup_Wizard.exe; Components: diysetup
  153. Name: {group}\词库信息统计工具; Filename: {app}\BigPayne\mbInfo.xls; Components: BigPayne

  154. [InstallDelete]
  155. Name: {sys}\freewb.ime; Type: files
  156. [UninstallDelete]
  157. Name: {app}\Info.ini; Type: files
  158. Name: {sys}\freewb.ime; Type: files
  159. Name: {sys}\freewbcode.dll; Type: files
  160. Name: {app}\Internet shortcuts; Type: filesandordirs
  161. Name: {app}\background\Thumbs.db; Type: files
  162. Name: {app}\background; Type: dirifempty

  163. [Run]
  164. ;Filename: {app}\registry.exe
  165. Filename: {app}\imetool\imetool.exe; Workingdir: {app}\imetool; Descri ption: 运行输入法调整工具; Flags: postinstall nowait; Components: imetools

  166. [UninstallRun]
  167. Filename: {app}\unInstallIME.exe; Parameters: " /c freewb.ime"; RunOnceId: UnloadKeyboardLayout

  168. [Types]
  169. Name: typical; Descri ption: 典型安装
  170. Name: full; Descri ption: 完全安装
  171. Name: compact; Descri ption: 最小安装
  172. Name: custom; Descri ption: 自定义安装; Flags: iscustom

  173. [Components]
  174. Name: Main; Descri ption: 主程序文件(含默认五笔86码表及皮肤背景); Flags: fixed; Types: custom compact full typical
  175. Name: dtool; Descri ption: 极点工具箱2.2; Types: full typical
  176. Name: diysetup; Descri ption: 极点便携定制向导; Types: full typical
  177. Name: add_mb; Descri ption: 词库与码表; Types: full

  178. #sub AddmbComponents
  179. Name: add_mb\{#mbIDArray[i]}; Descri ption: {#mbNameArray[i]}-{#mbVerArray[i]}({#mbSizeArray[i]}); Types: full
  180. #endsub

  181. #for {i = 0; i < mbcount; i++} AddmbComponents

  182. Name: add_skin; Descri ption: 附加的背景图与皮肤; Types: full typical
  183. Name: imetools; Descri ption: 输入法调整工具[Silence]; Types: full typical
  184. Name: pinyin; Descri ption: 22万词条拼音词库; Types: full
  185. Name: BigPayne; Descri ption: 词库信息统计工具[BigPayne]; Types: full

  186. [Languages]
  187. Name: Simplified_Chinese; MessagesFile: Simple Chinese.isl

  188. [Tasks]
  189. Name: SetDefaultMB; Descri ption: 指定默认码表与词库,如果不指定默认码表及词库将使用极点默认码表; Components: add_mb; Flags: unchecked
  190. #sub AddMbTasks ; 此处借用码表文件夹名作为Task名
  191. Name: SetDefaultMB\{#mbIDArray[i]}; Descri ption: {#mbNameArray[i]}-{#mbVerArray[i]}({#mbSizeArray[i]}); Components: add_mb\{#mbIDArray[i]}; Flags: unchecked exclusive
  192. #endsub
  193. ; 循环加入任务
  194. #for {i = 0; i < mbcount; i++} AddMbTasks

  195. [Messages]
  196. WelcomeLabel2=本程序将安装 [name/ver] 到您的计算机中。%n%n强烈建议您在继续安装之前关闭其他所有正在运行的程序,以避免安装过程中可能产生的相互冲突。%n%n★ 安装包版本: {#SetupPackType} {#SetupPackVersion}%n★ {#AppShortName}版本: {#ReleaseType} {#MajorVersion}{#DateVersion}
  197. BeveledLabel={#AppShortName}{#SetupPackType}
  198. FinishedRestartLabel=由于原来版本的部分 [name] 核心文件正在使用中,需要重启计算机才能完成更新。要最后完成 [name] 的安装,必须重新启动计算机。%n%n是否立即重新启动?
  199. FinishedRestartMessage=由于原来版本的部分 [name] 核心文件正在使用中,需要重启计算机才能完成更新。要最后完成 [name] 的安装,必须重新启动计算机。%n%n是否立即重新启动?
  200. AboutSetupNote={#AppName} 主页: http://www.freewb.net/%n五笔爱好者 主页: http://www.wbfans.com/ %n%n秋枫@[五笔爱好者]: arcqiufeng@hotmail.com

  201. [Registry]
  202. Root: HKLM; Subkey: SOFTWARE\极点中文; ValueType: string; ValueName: 系统目录; ValueData: {app}\; Flags: uninsdeletekeyifempty uninsdeletevalue
  203. [code]
  204. const
  205. DI_NORMAL = 3;
  206. var
  207. InstalledWarningPage, RunningWarningPage: TWizardPage;
  208. InstalledCheckBox, RunningCheckBox: TCheckBox;

  209. function ImmInstallIME(lpszIMEFileName, lpszLayoutText: String): LongInt;
  210. external ’ImmInstallIMEA@imm32.dll stdcall’;

  211. function GetModuleHandle(lpModuleName: LongInt): LongInt;
  212. external ’GetModuleHandleA@kernel32.dll stdcall’;
  213. function ExtractIcon(hInst: LongInt; lpszExeFileName: PChar; nIconIndex: LongInt): LongInt;
  214. external ’ExtractIconA@shell32.dll stdcall’;
  215. function DrawIconEx(hdc: LongInt; xLeft, yTop: Integer; hIcon: LongInt; cxWidth, cyWidth: Integer; istepIfAniCur: LongInt; hbrFlickerFreeDraw, diFlags: LongInt): LongInt;
  216. external ’DrawIconEx@user32.dll stdcall’;
  217. function DestroyIcon(hIcon: LongInt): LongInt;
  218. external ’DestroyIcon@user32.dll stdcall’;

  219. procedure CurPageChanged(CurPageID: Integer);
  220. var i: LongInt;
  221. begin
  222. if (CurPageID = InstalledWarningPage.ID) then
  223. WizardForm.NextButton.Enabled := InstalledCheckBox.Checked;

  224. if (CurPageID = RunningWarningPage.ID) then
  225. WizardForm.NextButton.Enabled := RunningCheckBox.Checked;

  226. if (CurPageID = wpFinished) then
  227. begin
  228. // 注册输入法
  229. // ------------------------------------------
  230. if usingWinNT then
  231. i:=ImmInstallIME(expandConstant(’{sys}\freewb.ime’),’中文 (简体) - 极点中文’)
  232. else
  233. i:=ImmInstallIME(expandConstant(’{sys}\freewb.ime’),’极点中文’);

  234. if i<>0 then
  235. // SetIniInt(’General’, ’KeyboardLayout’, i, ExpandConstant(’{app}\Info.ini’))
  236. else
  237. MsgBox(’输入法加载失败’, mbCriticalError, mb_Ok);
  238. end;
  239. end;

  240. procedure CurStepChanged(CurStep: TSetupStep);
  241. begin
  242. if CurStep = ssDone then
  243. begin

  244. // 设置默认码表
  245. // -------------------------------------------
  246. #sub SetDefaultMB
  247. if IsTaskSelected(’SetDefaultMB\{#mbIDArray[i]}’) then
  248. SetIniString(’系统设置’, ’当前输入方案’, ’{#mbNameArray[i]}’, ExpandConstant(’{app}\freewb.ini’));
  249. #endsub

  250. #for {i = 0; i < mbcount; i++} SetDefaultMB

  251. // 创建快捷方式
  252. // --------------------------------------------

  253. // 快捷键位表; Filename: {app}\Internet shortcuts\ShortcutKeys.url
  254. SetIniString(’InternetShortcut’, ’url’,
  255. ExpandConstant(’mk:@MSITStore:{app}\freewb.chm::/6_1_shortcut.htm’),
  256. ExpandConstant(’{app}\Internet shortcuts\ShortcutKeys.url’));

  257. // 快捷命令表; Filename: {app}\Internet shortcuts\ShortcutCommands.url
  258. SetIniString(’InternetShortcut’, ’url’,
  259. ExpandConstant(’mk:@MSITStore:{app}\freewb.chm::/6_3_command.htm’),
  260. ExpandConstant(’{app}\Internet shortcuts\ShortcutCommands.url’));

  261. // FAQ
  262. SetIniString(’InternetShortcut’, ’url’,
  263. ExpandConstant(’mk:@MSITStore:{app}\FREEWB.CHM::/7_1_introduction.htm’),
  264. ExpandConstant(’{app}\Internet shortcuts\FAQ.url’));

  265. // 极点应用技巧; Filename: {app}\Internet shortcuts\Skill.url
  266. SetIniString(’InternetShortcut’, ’url’,
  267. ExpandConstant(’mk:@MSITStore:{app}\freewb.chm::/0_1_skill.htm’),
  268. ExpandConstant(’{app}\Internet shortcuts\Skill.url’));

  269. end; //end if ssDone

  270. end;

  271. function FreewbAlreadyInstalled: boolean;
  272. begin
  273. result := RegValueExists(HKLM, ’Software\极点中文’, ’系统目录’);
  274. end;

  275. #ifndef hasMutex
  276. // 4.0(2004.2.27)公测版及其以前的极点内核代码
  277. function FreewbUsing: boolean;
  278. var FreewbName, TempFileName: string;
  279. begin
  280. result := false;
  281. TempFileName := ExpandConstant(’{sys}\freewb_tempRenamed.ime.tmp’);
  282. FreewbName := ExpandConstant(’{sys}\freewb.ime’);
  283. if fileexists(FreewbName) then
  284. begin
  285. FileCopy(FreewbName, TempFileName, false); // make a backup copy of freewb.ime
  286. if DeleteFile(FreewbName) then
  287. RenameFile(TempFileName, FreewbName) // revert to origin name
  288. else
  289. begin
  290. DeleteFile(TempFileName);
  291. result := true;
  292. end;
  293. end;
  294. result := result or (0 <> FindWindowByClassName(’JDCLASS_UI’)); //双保险.
  295. end;
  296. #endif

  297. #ifdef hasMutex
  298. // 4.0B2 (2004.3.2)内测版及以后的极点内核代码
  299. function FreewbUsing(): boolean;
  300. begin
  301. result := CheckForMutexes(’mutex_freeime,Global\mutex_freeime’) // For Freewb4.0b2 and later.
  302. or (0 <> FindWindowByClassName(’JDCLASS_UI’)); //This line is for old version compatible reason.
  303. end;
  304. #endif

  305. function CreateCustomOptionPage(AAfterId: Integer; ACaption, ASubCaption, AIconFileName, ALabel1Caption, ALabel2Caption,
  306. ACheckCaption: String; var CheckBox: TCheckBox): TWizardPage;
  307. var
  308. Page: TWizardPage;
  309. Rect: TRect;
  310. hIcon: LongInt;
  311. Label1, Label2: TNewStaticText;
  312. begin
  313. Page := CreateCustomPage(AAfterID, ACaption, ASubCaption);

  314. AIconFileName := ExpandConstant(’{tmp}\’ + AIconFileName);
  315. if not FileExists(AIconFileName) then
  316. ExtractTemporaryFile(ExtractFileName(AIconFileName));

  317. Rect.Left := 0;
  318. Rect.Top := 0;
  319. Rect.Right := 32;
  320. Rect.Bottom := 32;

  321. hIcon := ExtractIcon(GetModuleHandle(0), AIconFileName, 0);
  322. try
  323. with TBitmapImage.Create(Page) do begin
  324. with Bitmap do begin
  325. Width := 32;
  326. Height := 32;
  327. Canvas.Brush.Color := WizardForm.Color;
  328. Canvas.FillRect(Rect);
  329. DrawIconEx(Canvas.Handle, 0, 0, hIcon, 32, 32, 0, 0, DI_NORMAL);
  330. end;
  331. Parent := Page.Surface;
  332. end;
  333. finally
  334. DestroyIcon(hIcon);
  335. end;

  336. Label1 := TNewStaticText.Create(Page);
  337. with Label1 do begin
  338. AutoSize := False;
  339. Left := WizardForm.SelectDirLabel.Left;
  340. Width := Page.SurfaceWidth - Left;
  341. WordWrap := True;
  342. Caption := ALabel1Caption;
  343. Parent := Page.Surface;
  344. end;
  345. WizardForm.AdjustLabelHeight(Label1);

  346. Label2 := TNewStaticText.Create(Page);
  347. with Label2 do begin
  348. Top := Label1.Top + Label1.Height + ScaleY(12);
  349. Caption := ALabel2Caption;
  350. Parent := Page.Surface;
  351. end;
  352. WizardForm.AdjustLabelHeight(Label2);

  353. CheckBox := TCheckBox.Create(Page);
  354. with CheckBox do begin
  355. Top := Label2.Top + Label2.Height + ScaleY(12);
  356. Width := Page.SurfaceWidth;
  357. Caption := ACheckCaption;
  358. Parent := Page.Surface;
  359. end;

  360. Result := Page;
  361. end;

  362. procedure CreateCustomPages;
  363. var
  364. Caption, SubCaption1, IconFileName, Label1Caption, Label2Caption, CheckCaption: String;
  365. begin
  366. //极点已经安装
  367. Caption := ’提示’;
  368. SubCaption1 := ’系统中已经安装有{#AppName}’;
  369. IconFileName := ’info.ico’;
  370. Label1Caption :=
  371. ’您的系统中已经安装有{#AppName}。’#13#10#13#10 +
  372. ’尽管安装程序将尽量保存你的原来的设置,但仍然建议您备份好自己的词库,安装新版本之前最好先卸载原来的版本。’ ;
  373. Label2Caption := ’请选择是否继续安装。选择[下一步]继续安装,或[取消]退出安装程序。’;
  374. CheckCaption := ’继续安装’;

  375. InstalledWarningPage := CreateCustomOptionPage(wpWelcome, Caption, SubCaption1, IconFileName, Label1Caption, Label2Caption, CheckCaption, InstalledCheckBox);

  376. //极点正在运行
  377. Caption := ’警告’;
  378. SubCaption1 := ’旧版的{#AppName}正在使用中’;
  379. IconFileName := ’confirm.ico’;
  380. Label1Caption :=
  381. ’您的系统中已经安装有{#AppName}并且正在使用中。’#13#10#13#10 +
  382. ’尽管安装程序将尽量保存你的原来的设置,但仍然建议您备份好自己的词库,安装新版本之前最好先卸载原来的版本。’#13#10#13#10 +
  383. ’如果您要强制覆盖安装,建议您关闭所有正在使用{#AppName}的程序。否则安装完后将需要重启计算机。’;
  384. Label2Caption := ’请选择是否强制安装。选择[下一步]继续安装,或[取消]退出安装程序。’;
  385. CheckCaption := ’强制覆盖安装,安装完后重启计算机’;

  386. RunningWarningPage := CreateCustomOptionPage(InstalledWarningPage.ID, Caption, SubCaption1, IconFileName, Label1Caption, Label2Caption, CheckCaption, RunningCheckBox);
  387. end;

  388. procedure RunningCheckBoxOnClick(Sender: TObject);
  389. begin
  390. WizardForm.NextButton.Enabled := RunningCheckBox.Checked;
  391. end;

  392. procedure InstalledCheckBoxOnClick(Sender: TObject);
  393. begin
  394. WizardForm.NextButton.Enabled := InstalledCheckBox.Checked;
  395. end;

  396. procedure InitializeWizard();
  397. begin
  398. CreateCustomPages;

  399. InstalledCheckBox.Checked := true;
  400. RunningCheckBox.Checked := false;
  401. InstalledCheckBox.OnClick := @InstalledCheckBoxOnClick;
  402. RunningCheckBox.OnClick := @RunningCheckBoxOnClick;

  403. // 默认按钮:我同意
  404. // WizardForm.LICENSEACCEPTEDRADIO.Checked := true;

  405. // 更新 ReaMe 日期信息
  406. WizardForm.InfoBeforeMemo.Lines.Insert(0, ’秋枫 <arcqiufeng@163.com> {#LastUpdate}’);
  407. WizardForm.InfoBeforeMemo.Lines.Insert(0, ’******************************************’);
  408. WizardForm.InfoBeforeMemo.Lines.Insert(0, ’安装包信息及历史更新’);

  409. end;

  410. function ShouldSkipPage(PageID: Integer): Boolean;
  411. begin
  412. Result := false;

  413. if (PageID = InstalledWarningPage.ID) then //已经安装警告页跳过的情况:极点没有安装 或 极点正在使用(用另一个警告页)
  414. begin
  415. Result := (not FreewbAlreadyInstalled)
  416. or FreewbUsing;
  417. end;

  418. if (PageID = RunningWarningPage.ID) then //正在使用警告页跳过的情况:极点没有安装 或 极点装了但没有在用(只需显示已经安装警告框就行)
  419. begin
  420. Result := (not FreewbAlreadyInstalled)
  421. or (FreewbAlreadyInstalled and (not FreewbUsing));
  422. end;

  423. end;

  424. function InitializeSetup(): Boolean;
  425. var
  426. SplashImage : TBitmapImage;
  427. SplashForm : TForm;
  428. SplashFileName : String;
  429. Splash_x : integer;
  430. Splash_y : integer;
  431. Splash_t : double;
  432. begin
  433. // -------------------------
  434. // Create Start Splash
  435. // -------------------------
  436. Splash_x := 450;
  437. Splash_y := 200;
  438. Splash_t := 3; // in seconds
  439. SplashFileName := ExpandConstant(’{tmp}\splash.bmp’);
  440. ExtractTemporaryFile(’Splash.bmp’);
  441. SplashForm := TForm.create(nil);
  442. with SplashForm do
  443. begin
  444. BorderStyle := bsNone;
  445. Position := poScreenCenter;
  446. ClientWidth := Splash_x;
  447. ClientHeight := Splash_y;
  448. end;

  449. SplashImage := TBitmapImage.Create(SplashForm);
  450. with SplashImage do
  451. begin
  452. Bitmap.LoadFromFile(SplashFileName);
  453. Stretch := true;
  454. Align := alClient;
  455. Parent := SplashForm;
  456. end;

  457. with SplashForm do
  458. begin
  459. Show;
  460. Repaint;
  461. Sleep(round(Splash_t*1000));
  462. Close;
  463. Free;
  464. end;
  465. // ------- end splash ----------------

  466. result := true;
  467. end;
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SgzyStudio

GMT+8, 2024-5-18 14:25 , Processed in 0.113816 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表