flyinsono_Lab_All.iss 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833
  1. #define SetupAppVersion "2.9.0"
  2. #define SetupOutputDir "output"
  3. #define SetupAppName "FLYINSONO LAB"
  4. #define SetupAppPublisher "VINNO Technology (Suzhou) Co., Ltd ."
  5. #define SetupAppURL "http://www.flyinsono.com"
  6. #define SetupAppExeName "fis.exe"
  7. #define CopyRight "Copyright ?2022 VINNO Corporation. All rights reserved."
  8. #define ProjectFolder "pc_full_client_win"
  9. [setup]
  10. AppId={{708D995C-BDEF-44B0-B162-D480D7180340}
  11. AppName={cm:SetupAppName}
  12. AppVersion={#SetupAppVersion}
  13. AppVerName={cm:SetupAppName} {#SetupAppVersion}
  14. DefaultDirName={userappdata}\{cm:SetupAppName}
  15. OutputBaseFilename=FlyinsonoLab安装程序
  16. VersionInfoDescription={cm:SetupAppName}
  17. VersionInfoProductName={cm:SetupAppName}
  18. VersionInfoCopyright={#CopyRight}
  19. VersionInfoVersion={#SetupAppVersion}
  20. SetupIconFile=flyinsono.ico
  21. UninstallDisplayIcon={app}\flyinsono.ico
  22. OutputDir={#SetupOutputDir}
  23. Compression=lzma2
  24. DisableWelcomePage=yes
  25. DisableReadyPage=yes
  26. DisableProgramGroupPage=yes
  27. DirExistsWarning=no
  28. LanguageDetectionMethod=uilanguage
  29. ShowLanguageDialog=no
  30. ArchitecturesAllowed=x64
  31. ChangesAssociations=yes
  32. DiskSpanning=yes
  33. PrivilegesRequired=admin
  34. [Languages]
  35. Name: "english"; MessagesFile: "compiler:Languages\English.isl"
  36. Name: "chinese"; MessagesFile: "compiler:Languages\ChineseSimp.isl"
  37. [CustomMessages]
  38. english.SetupAppName=Flyinsono Lab
  39. english.SetupWizarde=Setup Wizard
  40. english.FinishedRestartMessage=To complete the installation of [Flyinsono], Setup must restart your computer.%n%nWould you like to restart now?
  41. english.NotSupportXP=Windows XP is not supported.
  42. english.NotSupportWin7=Windows 7 (without SP1) is not supported. %n%nWould you like to download the Windows 7 SP1 patch now?
  43. chinese.SetupAppName=杏聆荟科研工作站
  44. chinese.SetupWizarde=安装向导
  45. chinese.FinishedRestartMessage=为了完成 [杏聆荟科研工作站] 的安装,安装向导必须重启电脑。%n%n你要立即重启吗?
  46. chinese.NotSupportXP=杏聆荟科研工作站软件无法在Windows XP系统上进行安装。
  47. chinese.NotSupportWin7=杏聆荟科研工作站软件无法在未安装SP1补丁的Windows 7系统上进行安装。%n%n你要下载Windows 7 SP1 补丁吗?
  48. [Messages]
  49. english.SetupAppTitle=Flyinsono Setup Wizard
  50. english.SetupWindowTitle=Flyinsono Setup Wizard
  51. chinese.SetupAppTitle=杏聆荟科研版安装向导
  52. chinese.SetupWindowTitle=杏聆荟科研版安装向导
  53. [Files]
  54. //onlyifdoesntexist 仅在文件不存在的时候 安装
  55. //Source: extra\FlyinsonoLabServer\*; DestDir: "C:\FlyinsonoLabServer"; Flags: ignoreversion recursesubdirs createallsubdirs;
  56. //Source: extra\VinnoApp\*; DestDir: "C:\VinnoApp"; Flags: recursesubdirs createallsubdirs ignoreversion onlyifdoesntexist;
  57. //Source: extra\MATLAB_Runtime_R2020b_Update_8_win64\*; DestDir: "{app}\MATLAB_Runtime_R2020b_Update_8_win64"; Flags: recursesubdirs createallsubdirs ignoreversion onlyifdoesntexist;
  58. Source: resource\*; DestDir: {tmp}; Flags: dontcopy solidbreak ; Attribs: hidden system
  59. Source: {#ProjectFolder}\App\*; DestDir: "{app}\App"; Flags: ignoreversion recursesubdirs createallsubdirs; BeforeInstall: BeforeInstallFis
  60. Source: {#ProjectFolder}\CefGlueBrowserProcess\*; DestDir: "{app}\CefGlueBrowserProcess"; Flags: ignoreversion recursesubdirs createallsubdirs;
  61. Source: {#ProjectFolder}\SmartPublisher\*; DestDir: "{app}\SmartPublisher"; Flags: ignoreversion recursesubdirs createallsubdirs;
  62. Source: {#ProjectFolder}\RtmpServer\*; DestDir: "{app}\RtmpServer"; Flags: ignoreversion recursesubdirs createallsubdirs;
  63. Source: {#ProjectFolder}\Resources\*; DestDir: "{app}\Resources"; Flags: ignoreversion recursesubdirs createallsubdirs;
  64. Source: {#ProjectFolder}\swiftshader\*; DestDir: "{app}\swiftshader"; Flags: ignoreversion recursesubdirs createallsubdirs;
  65. Source: {#ProjectFolder}\cef.pak; DestDir: "{app}"; Flags: ignoreversion;
  66. Source: {#ProjectFolder}\FisPrintDrive.exe; DestDir: "{app}"; Flags: ignoreversion;
  67. Source: {#ProjectFolder}\cef_100_percent.pak; DestDir: "{app}"; Flags: ignoreversion;
  68. Source: {#ProjectFolder}\cef_200_percent.pak; DestDir: "{app}"; Flags: ignoreversion;
  69. Source: {#ProjectFolder}\cef_extensions.pak; DestDir: "{app}"; Flags: ignoreversion;
  70. Source: {#ProjectFolder}\chrome_elf.dll; DestDir: "{app}"; Flags: ignoreversion;
  71. Source: {#ProjectFolder}\concrt140.dll; DestDir: "{app}"; Flags: ignoreversion;
  72. Source: {#ProjectFolder}\cvextern.dll; DestDir: "{app}"; Flags: ignoreversion;
  73. Source: {#ProjectFolder}\d3dcompiler_47.dll; DestDir: "{app}"; Flags: ignoreversion;
  74. Source: {#ProjectFolder}\devtools_resources.pak; DestDir: "{app}"; Flags: ignoreversion;
  75. Source: {#ProjectFolder}\fis.exe; DestDir: "{app}"; Flags: ignoreversion;
  76. Source: {#ProjectFolder}\flyinsono.ico; DestDir: "{app}"; Flags: ignoreversion;
  77. Source: {#ProjectFolder}\icudtl.dat; DestDir: "{app}"; Flags: ignoreversion;
  78. Source: {#ProjectFolder}\libcef.dll; DestDir: "{app}"; Flags: ignoreversion;
  79. Source: {#ProjectFolder}\libEGL.dll; DestDir: "{app}"; Flags: ignoreversion;
  80. Source: {#ProjectFolder}\libGLESv2.dll; DestDir: "{app}"; Flags: ignoreversion;
  81. Source: {#ProjectFolder}\libHarfBuzzSharp.dll; DestDir: "{app}"; Flags: ignoreversion;
  82. Source: {#ProjectFolder}\libSkiaSharp.dll; DestDir: "{app}"; Flags: ignoreversion;
  83. Source: {#ProjectFolder}\msvcp140.dll; DestDir: "{app}"; Flags: ignoreversion;
  84. Source: {#ProjectFolder}\msvcp140_1.dll; DestDir: "{app}"; Flags: ignoreversion;
  85. Source: {#ProjectFolder}\msvcp140_2.dll; DestDir: "{app}"; Flags: ignoreversion;
  86. Source: {#ProjectFolder}\msvcp140_atomic_wait.dll; DestDir: "{app}"; Flags: ignoreversion;
  87. Source: {#ProjectFolder}\msvcp140_codecvt_ids.dll; DestDir: "{app}"; Flags: ignoreversion;
  88. Source: {#ProjectFolder}\snapshot_blob.bin; DestDir: "{app}"; Flags: ignoreversion;
  89. Source: {#ProjectFolder}\v8_context_snapshot.bin; DestDir: "{app}"; Flags: ignoreversion;
  90. Source: {#ProjectFolder}\vcruntime140.dll; DestDir: "{app}"; Flags: ignoreversion;
  91. Source: {#ProjectFolder}\vcruntime140_1.dll; DestDir: "{app}"; Flags: ignoreversion;
  92. Source: {#ProjectFolder}\resources.pak; DestDir: "{app}"; Flags: ignoreversion;
  93. Source: {#ProjectFolder}\Versions.txt; DestDir: "{app}"; Flags: ignoreversion;
  94. Source: {#ProjectFolder}\fis.Upgrader.exe; DestDir: "{app}"; Flags: ignoreversion;
  95. Source: extra\en-US.pak; DestDir: "{app}\locales"; Flags: ignoreversion;
  96. Source: extra\zh-CN.pak; DestDir: "{app}\locales"; Flags: ignoreversion;
  97. Source: extra\zh-TW.pak; DestDir: "{app}\locales"; Flags: ignoreversion;
  98. Source: extra\ru.pak; DestDir: "{app}\locales"; Flags: ignoreversion;
  99. Source: extra\dotnet-runtime-6.0.0-win-x64.exe; DestDir: "{app}"; Flags: ignoreversion;
  100. Source: extra\Windows6.1-KB3063858-x64.msu; DestDir: "{app}"; Flags: ignoreversion;
  101. Source: extra\loader.exe; DestDir: "{app}"; Flags: ignoreversion;
  102. Source: flyinsono.ico; DestDir: "{app}"; Flags: ignoreversion;
  103. Source: extra\flyinsono_Web.ico; DestDir: "{app}"; Flags: ignoreversion;
  104. Source: extra\updateVersions_All.bat; DestDir: "{app}"; Flags: ignoreversion;
  105. //桌面快捷方式
  106. [Icons]
  107. Name: "{group}\{cm:SetupAppName}"; Filename: "{app}\loader.exe"; IconFilename: "{app}\flyinsonoLab.ico";
  108. Name: "{commondesktop}\{cm:SetupAppName}"; Filename: "{app}\loader.exe"; IconFilename: "{app}\flyinsonoLab.ico";
  109. Name: "{commondesktop}\杏聆荟科研工作站-管理后台"; Filename: "http://127.0.0.1:9302"; IconFilename: "{app}\flyinsono_Web.ico";
  110. [Run]
  111. Filename: "{app}\updateVersions_All.bat"; Flags: runhidden;
  112. Filename: "{app}\Windows6.1-KB3063858-x64.msu"; Parameters: "/quiet /norestart"; Flags: runascurrentuser shellexec; Check:NeedInstallKB3063858
  113. Filename: "{app}\dotnet-runtime-6.0.0-win-x64.exe"; Parameters: "/quiet"; Flags: runascurrentuser; Check:NeedInstallDotnet6
  114. Filename: "{app}\MATLAB_Runtime_R2020b_Update_8_win64\setup.exe"; Parameters: "-mode silent -agreeToLicense yes"; Flags: runascurrentuser waituntilterminated; Check:not IsMatlabInstalled
  115. [UninstallDelete]
  116. Type: filesandordirs; Name: "C:\FlyinsonoLabServer"
  117. [UninstallRun]
  118. Filename: "taskkill.exe"; Parameters: "/f /t /im FlyinsonoDaemon.exe"; Flags: runhidden
  119. Filename: "taskkill.exe"; Parameters: "/f /t /im loader.exe"; Flags: runhidden
  120. Filename: "taskkill.exe"; Parameters: "/f /im Xilium.CefGlue.BrowserProcess.exe"; Flags: runhidden
  121. Filename: "taskkill.exe"; Parameters: "/f /t /im fis.exe"; Flags: runhidden
  122. Filename: "C:\FlyinsonoLabServer\close.bat"; Parameters: ""; Flags: runhidden skipifdoesntexist
  123. [Registry]
  124. Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};C:\VinnoApp\ipp_2018;C:\VinnoApp\HQPostFilter"; Flags: preservestringtype
  125. [code]
  126. #include 'dll.iss'
  127. function IsMatlabInstalled(): Boolean;
  128. var
  129. MatlabKey: string;
  130. begin
  131. // MATLAB 注册表项的典型位置
  132. MatlabKey := 'SOFTWARE\MathWorks\MATLAB Runtime';
  133. // 初始化结果为 false
  134. Result := False;
  135. // 尝试读取 64 位视图下的注册表键
  136. if RegKeyExists(HKEY_LOCAL_MACHINE_64, MatlabKey) then
  137. begin
  138. Result := True;
  139. Log('MATLAB Runtime is installed at ' + MatlabKey);
  140. end
  141. else
  142. begin
  143. Log('MATLAB Runtime is not installed at ' + MatlabKey);
  144. end;
  145. end;
  146. const
  147. SHCNE_ASSOCCHANGED = $08000000;
  148. SHCNF_IDLIST = $00000000;
  149. var
  150. BackgroundImage, LicenseBackgroundImage, ProgressBarBackgroundImage,ProgressBarImage, MinButton,CloseButton, SetupButton, SelectFolderButton,LicenseCheckBox,LicenseButton, LicenseBackButton, CustomSetupButton:HWND;
  151. CustomPathEdit:TEdit;
  152. LicenseRichEditViewer:TRichEditViewer;
  153. AdPlayerTimer: TTimer;
  154. ProgressBarMessageHandler:LongInt;
  155. CustomSetup,NormalSetup:boolean;
  156. RestartRequired: boolean;
  157. procedure SHChangeNotify(wEventID: integer; uFlags: cardinal; dwItem1, dwItem2: cardinal); external 'SHChangeNotify@shell32.dll stdcall';
  158. procedure SendChangeNotification;
  159. begin
  160. SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
  161. end;
  162. procedure ExecuteBatchIfPresent();
  163. var
  164. BatchFilePath: String;
  165. ResultCode: Integer;
  166. begin
  167. BatchFilePath := ExpandConstant('C:\FlyinsonoLabServer\close.bat');
  168. if FileExists(BatchFilePath) then
  169. begin
  170. Exec(BatchFilePath, '', '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
  171. end;
  172. end;
  173. procedure TaskKill(FileName: String);
  174. var
  175. ResultCode: Integer;
  176. begin
  177. Exec(ExpandConstant('taskkill.exe'),'/f /im ' + '"' + FileName + '"','',SW_HIDE,ewWaitUntilTerminated,ResultCode);
  178. end;
  179. procedure BeforeInstallFis();
  180. begin
  181. TaskKill('FlyinsonoDaemon.exe');
  182. TaskKill('loader.exe');
  183. TaskKill('Xilium.CefGlue.BrowserProcess.exe');
  184. TaskKill('fis.exe');
  185. TaskKill('nginx.exe');
  186. TaskKill('cmd.exe');
  187. ExecuteBatchIfPresent();
  188. end;
  189. function IsWindowsXPOr2000: Boolean;
  190. var
  191. Version: TWindowsVersion;
  192. begin
  193. GetWindowsVersionEx(Version);
  194. if Version.Major = 5 then
  195. begin
  196. Result := True;
  197. end
  198. else
  199. begin
  200. Result := False;
  201. end;
  202. end;
  203. function IsWindows7:Boolean;
  204. var
  205. Version: TWindowsVersion;
  206. begin
  207. GetWindowsVersionEx(Version);
  208. if (Version.Major = 6) and (Version.Minor = 1) then
  209. begin
  210. if Version.ServicePackMajor = 0 then
  211. begin
  212. Result := True;
  213. end
  214. else
  215. begin
  216. Result := False;
  217. end;
  218. end
  219. else
  220. begin
  221. Result := False;
  222. end;
  223. end;
  224. function IsWindows7SP1:Boolean;
  225. var
  226. Version: TWindowsVersion;
  227. begin
  228. GetWindowsVersionEx(Version);
  229. if (Version.Major =6) and (Version.Minor = 1) then
  230. begin
  231. if Version.ServicePackMajor = 1 then
  232. begin
  233. Result := True;
  234. end
  235. else
  236. begin
  237. Result := False;
  238. end;
  239. end
  240. else
  241. begin
  242. Result := False;
  243. end;
  244. end;
  245. function IsDotnet6Installed: boolean;
  246. begin
  247. Result := False;
  248. if FileExists('C:\Program Files\dotnet\host\fxr\6.0.0\hostfxr.dll') then
  249. begin
  250. Result := True;
  251. end
  252. else
  253. begin
  254. Result := False;
  255. end;
  256. end;
  257. function NeedInstallKB3063858: boolean;
  258. begin
  259. if (not IsDotnet6Installed) and (IsWindows7SP1) then
  260. begin
  261. RestartRequired := true;
  262. Result := True;
  263. end
  264. else
  265. begin
  266. RestartRequired := false;
  267. Result := False;
  268. end;
  269. end;
  270. function NeedInstallDotnet6: boolean;
  271. begin
  272. Result := not IsDotnet6Installed;
  273. end;
  274. procedure RestartOS();
  275. var
  276. Params: string;
  277. ErrorCode: Integer;
  278. begin
  279. Params := '-r -t 0';
  280. //Exec('shutdown', Params, '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
  281. ShellExec('', 'shutdown',Params, '', SW_HIDE, ewNoWait, ErrorCode);
  282. end;
  283. procedure OnCloseButtonClick(HButton:HWND);
  284. begin
  285. WizardForm.CancelButton.Click;
  286. end;
  287. procedure OnMinButtonClick(HButton:HWND);
  288. begin
  289. SendMessage(WizardForm.Handle,WM_SYSCOMMAND,61472,0);
  290. end;
  291. procedure OnCustomSetupButtonClick(HButton:HWND);
  292. begin
  293. if CustomSetup then
  294. begin
  295. BtnSetPosition(LicenseCheckBox,22,474,15,15);
  296. if ExpandConstant('{language}') = 'chinese' then
  297. begin
  298. BtnSetPosition(LicenseButton,100,474,108,15);
  299. BtnSetPosition(CustomSetupButton,560,479,75,15);
  300. end
  301. else
  302. begin
  303. BtnSetPosition(LicenseButton,100,474,167,15);
  304. BtnSetPosition(CustomSetupButton,522,479,113,15);
  305. end;
  306. CustomPathEdit.Show;
  307. BtnSetVisibility(SelectFolderButton,true)
  308. WizardForm.Height:=508
  309. BackgroundImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg_custom_setup_{language}.png'),0,0,650,508,true,true);
  310. CustomSetup := false
  311. end
  312. else
  313. begin
  314. BtnSetPosition(LicenseCheckBox,22,420,15,15);
  315. if ExpandConstant('{language}') = 'chinese' then
  316. begin
  317. BtnSetPosition(LicenseButton,100,420,108,15);
  318. BtnSetPosition(CustomSetupButton,560,421,75,15);
  319. end
  320. else
  321. begin
  322. BtnSetPosition(LicenseButton,100,421,167,15);
  323. BtnSetPosition(CustomSetupButton,522,421,113,15);
  324. end;
  325. CustomPathEdit.Hide;
  326. BtnSetVisibility(SelectFolderButton,false)
  327. WizardForm.Height:=450
  328. BackgroundImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg_normal_{language}.png'),0,0,650,450,false,true);
  329. CustomSetup := true
  330. end;
  331. ImgApplyChanges(WizardForm.Handle)
  332. end;
  333. procedure OnSelectFolderButtonclick(HButton:HWND);
  334. begin
  335. WizardForm.DirBrowseButton.Click;
  336. CustomPathEdit.text := WizardForm.DirEdit.text;
  337. end;
  338. procedure CustomPathEditChange(Sender: TObject);
  339. begin
  340. if CustomPathEdit.Text <> '' then
  341. begin
  342. WizardForm.DirEdit.text:=CustomPathEdit.Text;
  343. end;
  344. end;
  345. procedure OnLicenseCheckBoxClick(HButton:HWND);
  346. begin
  347. if BtnGetChecked(LicenseCheckBox)=true then
  348. begin
  349. BtnSetEnabled(SetupButton,true)
  350. end
  351. else
  352. begin
  353. BtnSetEnabled(SetupButton,false)
  354. end
  355. end;
  356. procedure OnSetupButtonClick(HButton:HWND);
  357. begin
  358. WizardForm.NextButton.Click;
  359. end;
  360. procedure OnFinishButtonClick(HButton:HWND);
  361. var
  362. ErrorCode: Integer;
  363. begin
  364. SendChangeNotification;
  365. if RestartRequired then
  366. begin
  367. if MsgBox(CustomMessage('FinishedRestartMessage'),mbConfirmation,MB_YESNO) = IDYES then
  368. begin
  369. RestartOS();
  370. end;
  371. end;
  372. ShellExec('open', ExpandConstant('{app}\loader.exe'),'', '', SW_SHOW, ewNoWait, ErrorCode);
  373. WizardForm.NextButton.Click;
  374. end;
  375. function ProcessProgressBarMessage(h:hWnd;Msg,wParam,lParam:Longint):Longint;
  376. var
  377. pr,i1,i2 : Extended;
  378. w : Integer;
  379. begin
  380. Result:=CallWindowProc(ProgressBarMessageHandler,h,Msg,wParam,lParam);
  381. if (Msg=$402) and (WizardForm.ProgressGauge.Position>WizardForm.ProgressGauge.Min) then
  382. begin
  383. i1:=WizardForm.ProgressGauge.Position-WizardForm.ProgressGauge.Min;
  384. i2:=WizardForm.ProgressGauge.Max-WizardForm.ProgressGauge.Min;
  385. pr:=i1*100/i2;
  386. w:=Round(650*pr/100);
  387. ImgSetPosition(ProgressBarImage,0,375,w,15);
  388. ImgSetVisiblePart(ProgressBarImage,0,0,w,15);
  389. ImgApplyChanges(WizardForm.Handle);
  390. end;
  391. end;
  392. procedure OnWizardMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  393. begin
  394. ReleaseCapture;
  395. SendMessage(WizardForm.Handle, $0112, $F012, 0);
  396. end;
  397. var
  398. b1,b2,b3,b4,t1,t2,t3,t4:Longint;
  399. playStep:Integer;
  400. playIndex:Integer;
  401. waitTime:Integer;
  402. procedure OnAdPlayerTimerTimer(Sender: TObject); //核心代码 时钟控制动画 需要inno5 增强版
  403. begin
  404. if playIndex > 5 then
  405. begin
  406. playIndex := 1;
  407. playStep := 0;
  408. end;
  409. if waitTime >0 then
  410. begin
  411. waitTime := waitTime - 10;
  412. Exit;
  413. end;
  414. playStep := playStep + 10;
  415. if playStep<=650 then
  416. begin
  417. //控制显示图片
  418. if playIndex=1 then
  419. begin
  420. ImgSetPosition(t1,-650+playStep,0,650,374);
  421. ImgSetVisibility(t2,false);
  422. ImgSetVisibility(t3,false);
  423. ImgSetVisibility(t4,false);
  424. ImgSetVisibility(t1,true);
  425. end;
  426. if playIndex=2 then
  427. begin
  428. ImgSetPosition(t2,-650+playStep,0,650,374);
  429. ImgSetVisibility(t1,false);
  430. ImgSetVisibility(t3,false);
  431. ImgSetVisibility(t4,false);
  432. ImgSetVisibility(t2,true);
  433. ImgSetVisibility(b1,true);
  434. ImgSetVisibility(b3,false);
  435. ImgSetVisibility(b4,false);
  436. ImgSetVisibility(b2,false);
  437. end;
  438. if playIndex=3 then
  439. begin
  440. ImgSetPosition(t3,-650+playStep,0,650,374);
  441. ImgSetVisibility(t1,false);
  442. ImgSetVisibility(t2,false);
  443. ImgSetVisibility(t4,false);
  444. ImgSetVisibility(t3,true);
  445. ImgSetVisibility(b1,false);
  446. ImgSetVisibility(b3,false);
  447. ImgSetVisibility(b4,false);
  448. ImgSetVisibility(b2,true);
  449. end;
  450. if playIndex=4 then
  451. begin
  452. ImgSetPosition(t4,-650+playStep,0,650,374);
  453. ImgSetVisibility(t1,false);
  454. ImgSetVisibility(t2,false);
  455. ImgSetVisibility(t3,false);
  456. ImgSetVisibility(t4,true);
  457. ImgSetVisibility(b1,false);
  458. ImgSetVisibility(b3,true);
  459. ImgSetVisibility(b4,false);
  460. ImgSetVisibility(b2,false);
  461. end ;
  462. if playIndex=5 then
  463. begin
  464. ImgSetPosition(t1,-650+playStep,0,650,374);
  465. ImgSetVisibility(t2,false);
  466. ImgSetVisibility(t3,false);
  467. ImgSetVisibility(t4,false);
  468. ImgSetVisibility(t1,true);
  469. ImgSetVisibility(b1,false);
  470. ImgSetVisibility(b3,false);
  471. ImgSetVisibility(b4,true);
  472. ImgSetVisibility(b2,false);
  473. end;
  474. end;
  475. if playStep >= 650 then
  476. begin
  477. waitTime := 2000;
  478. playIndex := playIndex + 1;
  479. playStep := 0;
  480. end;
  481. ImgApplyChanges(WizardForm.Handle)
  482. end;
  483. procedure OnLicenseBackButtonClick(HButton:HWND);
  484. begin
  485. if CustomSetup=false then
  486. begin
  487. BtnSetPosition(LicenseCheckBox,22,420,15,15);
  488. if ExpandConstant('{language}') = 'chinese' then
  489. begin
  490. BtnSetPosition(LicenseButton,100,420,108,15);
  491. BtnSetPosition(CustomSetupButton,560,421,75,15);
  492. end
  493. else
  494. begin
  495. BtnSetPosition(LicenseButton,100,420,167,15);
  496. BtnSetPosition(CustomSetupButton,522,421,113,15);
  497. end;
  498. CustomPathEdit.Hide;
  499. BtnSetVisibility(SelectFolderButton,false)
  500. WizardForm.Height:=450
  501. BackgroundImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg_normal_{language}.png'),0,0,650,450,false,true);
  502. CustomSetup := true
  503. end;
  504. if NormalSetup=true then
  505. begin
  506. LicenseBackgroundImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg_license_{language}.png'),0,0,650,444,false,false);
  507. NormalSetup:=false
  508. LicenseRichEditViewer.Height:=321
  509. BtnSetVisibility(LicenseCheckBox,false)
  510. BtnSetVisibility(LicenseButton,false)
  511. BtnSetVisibility(CustomSetupButton,false)
  512. BtnSetVisibility(SetupButton,false)
  513. BtnSetVisibility(LicenseBackButton,true)
  514. end
  515. else
  516. begin
  517. NormalSetup:=true
  518. BackgroundImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg_normal_{language}.png'),0,0,650,450,false,true);
  519. LicenseRichEditViewer.Height:=0
  520. BtnSetVisibility(LicenseCheckBox,true)
  521. BtnSetVisibility(LicenseButton,true)
  522. BtnSetVisibility(CustomSetupButton,true)
  523. BtnSetVisibility(SetupButton,true)
  524. ImgRelease(LicenseBackgroundImage)
  525. BtnSetVisibility(LicenseBackButton,false)
  526. end;
  527. ImgApplyChanges(WizardForm.Handle)
  528. end;
  529. procedure InitializeWizard();
  530. var
  531. rtfstr:AnsiString;
  532. begin
  533. WizardForm.OuterNotebook.hide;
  534. WizardForm.Bevel.Hide;
  535. WizardForm.BorderStyle:=bsnone;
  536. WizardForm.Position:=poScreenCenter;
  537. WizardForm.Width:=650;
  538. WizardForm.Height:=508;
  539. WizardForm.Color:=clWhite ;
  540. NormalSetup:=true;
  541. WizardForm.OnMouseDown:=@OnWizardMouseDown
  542. CustomSetup := true;
  543. ExtractTemporaryFile(ExpandConstant('license_{language}.rtf'));
  544. ExtractTemporaryFile(ExpandConstant('edit_custom_folder_{language}.png'));
  545. ExtractTemporaryFile(ExpandConstant('bg_license_{language}.png'));
  546. ExtractTemporaryFile(ExpandConstant('bg_normal_{language}.png'));
  547. ExtractTemporaryFile(ExpandConstant('bg_custom_setup_{language}.png'));
  548. ExtractTemporaryFile(ExpandConstant('bg_finish_{language}.png'));
  549. ExtractTemporaryFile(ExpandConstant('bg_progress_{language}.png'));
  550. ExtractTemporaryFile(ExpandConstant('progress_{language}.png'));
  551. ExtractTemporaryFile(ExpandConstant('license_{language}.png'));
  552. ExtractTemporaryFile(ExpandConstant('loading_pic_{language}.png'));
  553. ExtractTemporaryFile(ExpandConstant('loading_pic1_{language}.png'));
  554. ExtractTemporaryFile(ExpandConstant('loading_pic2_{language}.png'));
  555. ExtractTemporaryFile(ExpandConstant('loading_pic3_{language}.png'));
  556. ExtractTemporaryFile(ExpandConstant('loading_pic4_{language}.png'));
  557. ExtractTemporaryFile(ExpandConstant('checkbox_{language}.png'));
  558. ExtractTemporaryFile(ExpandConstant('checkboxdeep_{language}.png'));
  559. ExtractTemporaryFile(ExpandConstant('btn_setup_{language}.png'));
  560. ExtractTemporaryFile(ExpandConstant('btn_custom_setup_{language}.png'));
  561. ExtractTemporaryFile(ExpandConstant('btn_select_folder_{language}.png'));
  562. ExtractTemporaryFile(ExpandConstant('btn_back_{language}.png'));
  563. ExtractTemporaryFile(ExpandConstant('btn_complete_{language}.png'));
  564. ExtractTemporaryFile(ExpandConstant('btn_close_{language}.png'));
  565. ExtractTemporaryFile(ExpandConstant('btn_min_{language}.png'));
  566. CloseButton:=BtnCreate(WizardForm.Handle,627,8,17,15,ExpandConstant('{tmp}\btn_close_{language}.png'),1,False)
  567. BtnSetEvent(CloseButton,BtnClickEventID,WrapBtnCallback(@OnCloseButtonClick,1));
  568. MinButton:=BtnCreate(WizardForm.Handle,603,8,17,15,ExpandConstant('{tmp}\btn_min_{language}.png'),1,False)
  569. BtnSetEvent(MinButton,BtnClickEventID,WrapBtnCallback(@OnMinButtonClick,1));
  570. SetupButton:=BtnCreate(WizardForm.Handle,225,308,199,58,ExpandConstant('{tmp}\btn_setup_{language}.png'),1,False)
  571. BtnSetEvent(SetupButton,BtnClickEventID,WrapBtnCallback(@OnSetupButtonClick,1));
  572. LicenseBackButton:=BtnCreate(WizardForm.Handle,274,380,102,42,ExpandConstant('{tmp}\btn_back_{language}.png'),1,False)
  573. BtnSetEvent(LicenseBackButton,BtnClickEventID,WrapBtnCallback(@OnLicenseBackButtonClick,1));
  574. BtnSetVisibility(LicenseBackButton,false)
  575. CustomPathEdit:= TEdit.Create(WizardForm);
  576. with CustomPathEdit do
  577. begin
  578. Parent := WizardForm;
  579. text :=WizardForm.DirEdit.text;
  580. Font.Name:='Microsoft YaHei'
  581. BorderStyle:=bsNone;
  582. SetBounds(60,383,440,24)
  583. OnChange:=@CustomPathEditChange;
  584. Color := $00524A49
  585. TabStop :=false;
  586. end;
  587. CustomPathEdit.Hide;
  588. SelectFolderButton := BtnCreate(WizardForm.Handle,520,375,75,32,ExpandConstant('{tmp}\btn_select_folder_{language}.png'),1,False)
  589. BtnSetEvent(SelectFolderButton,BtnClickEventID,WrapBtnCallback(@OnSelectFolderButtonclick,1));
  590. BtnSetVisibility(SelectFolderButton,false)
  591. if ExpandConstant('{language}') = 'chinese' then
  592. begin
  593. CustomSetupButton:=BtnCreate(WizardForm.Handle,560,421,75,15,ExpandConstant('{tmp}\btn_custom_setup_{language}.png'),1,False)
  594. end
  595. else
  596. begin
  597. CustomSetupButton:=BtnCreate(WizardForm.Handle,522,421,113,15,ExpandConstant('{tmp}\btn_custom_setup_{language}.png'),1,False)
  598. end;
  599. BtnSetEvent(CustomSetupButton,BtnClickEventID,WrapBtnCallback(@OnCustomSetupButtonClick,1));
  600. ProgressBarMessageHandler:=SetWindowLong(WizardForm.ProgressGauge.Handle,-4,PBCallBack(@ProcessProgressBarMessage,4));
  601. AdPlayerTimer := TTimer.Create(WizardForm);
  602. with AdPlayerTimer do
  603. begin
  604. OnTimer := @OnAdPlayerTimerTimer;
  605. end;
  606. playIndex := 1;
  607. playStep := 0;
  608. waitTime := 2000;
  609. LoadStringFromFile(ExpandConstant('{tmp}\license_{language}.rtf'), rtfstr);
  610. LicenseRichEditViewer:= TRichEditViewer.Create(WizardForm);
  611. with LicenseRichEditViewer do
  612. begin
  613. Parent := WizardForm;
  614. ReadOnly:= true;
  615. ScrollBars:= ssVertical;
  616. Font.Name:='Microsoft YaHei'
  617. Color:=clWhite;
  618. BorderStyle:= bsNone;
  619. SetBounds(42,36,567,187)
  620. TabStop:=false;
  621. Height := 0;
  622. RTFText := rtfstr;
  623. UseRichEdit := true;
  624. end;
  625. ImgApplyChanges(WizardForm.Handle)
  626. end;
  627. function InitializeSetup(): Boolean;
  628. var
  629. ErrorCode: Integer;
  630. begin
  631. if IsWindowsXPOr2000 then
  632. begin
  633. MsgBox(CustomMessage('NotSupportXP'), mbError, MB_OK);
  634. end
  635. else
  636. if IsWindows7 then
  637. begin
  638. // 用是或否询问用户下载Win7SP1 补丁
  639. if MsgBox(CustomMessage('NotSupportWin7'), mbConfirmation, MB_YESNO) = IDYES then
  640. begin
  641. ShellExec('open', 'https://download.fis.plus/windows6.1-KB976932-X64.exe','', '', SW_SHOW, ewNoWait, ErrorCode);
  642. end;
  643. end
  644. else
  645. begin
  646. Result := True;
  647. end;
  648. end;
  649. procedure DeinitializeSetup();
  650. begin
  651. gdipShutdown;
  652. if ProgressBarMessageHandler<>0 then
  653. begin
  654. SetWindowLong(WizardForm.ProgressGauge.Handle,-4,ProgressBarMessageHandler);
  655. end;
  656. end;
  657. procedure CurPageChanged(CurPageID: Integer);
  658. begin
  659. WizardForm.NextButton.Visible:=false;
  660. WizardForm.CancelButton.Height:=0;
  661. WizardForm.BackButton.Height:=0;
  662. if CurPageID = wpWelcome then
  663. begin
  664. WizardForm.NextButton.OnClick(WizardForm);
  665. end;
  666. if CurPageID=wpSelectDir then
  667. begin
  668. BackgroundImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg_normal_{language}.png'),0,0,650,450,true,true);
  669. if ExpandConstant('{language}') = 'chinese' then
  670. begin
  671. LicenseButton:=BtnCreate(WizardForm.Handle,102,420,108,16,ExpandConstant('{tmp}\license_{language}.png'),4,false)
  672. end
  673. else
  674. begin
  675. LicenseButton:=BtnCreate(WizardForm.Handle,100,420,167,15,ExpandConstant('{tmp}\license_{language}.png'),4,false)
  676. end;
  677. BtnSetEvent(LicenseButton,BtnClickEventID,WrapBtnCallback(@OnLicenseBackButtonClick,1));
  678. LicenseCheckBox:=BtnCreate(WizardForm.Handle,22,421,15,15,ExpandConstant('{tmp}\checkboxdeep_{language}.png'),1,true)
  679. BtnSetEvent(LicenseCheckBox,BtnClickEventID,WrapBtnCallback(@OnLicenseCheckBoxClick,1));
  680. BtnSetChecked(LicenseCheckBox,true)
  681. WizardForm.Width:=650;
  682. WizardForm.Height:=450;
  683. WizardForm.Show;
  684. end ;
  685. if CurPageID = wpInstalling then
  686. begin
  687. BtnSetPosition(LicenseCheckBox,560,421,75,15);
  688. if ExpandConstant('{language}') = 'chinese' then
  689. begin
  690. BtnSetPosition(CustomSetupButton,560,421,75,15);
  691. end
  692. else
  693. begin
  694. BtnSetPosition(CustomSetupButton,522,421,113,15);
  695. end;
  696. CustomPathEdit.Hide;
  697. BtnSetVisibility(SelectFolderButton,false)
  698. WizardForm.Height:=450
  699. CustomSetup := true
  700. BtnSetVisibility(CustomSetupButton,false);
  701. BtnSetVisibility(LicenseButton,false);
  702. BtnSetVisibility(LicenseCheckBox,false);
  703. BackgroundImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\loading_pic_{language}.png'),0,0,650,450,false,true);
  704. ProgressBarBackgroundImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg_progress_{language}.png'),0,375,660,15,true,true);
  705. ProgressBarImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\progress_{language}.png'),0,375,0,0,True,True);
  706. t1:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\loading_pic1_{language}.png'),0,0,650,374,true,true); //加载图片必备的
  707. t2:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\loading_pic2_{language}.png'),0,0,650,374,true,true);
  708. t3:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\loading_pic3_{language}.png'),0,0,650,374,true,true);
  709. t4:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\loading_pic4_{language}.png'),0,0,650,374,true,true);
  710. ImgSetVisibility(t1,false) //出现动画时 第一张显示的图片 下面几张禁用的
  711. ImgSetVisibility(t2,false)
  712. ImgSetVisibility(t3,false)
  713. ImgSetVisibility(t4,false)
  714. BtnSetVisibility(SetupButton,false);
  715. AdPlayerTimer.Interval:= 10;
  716. end ;
  717. if CurPageID = wpFinished then
  718. begin
  719. AdPlayerTimer.Interval:=0
  720. ImgSetVisibility(ProgressBarBackgroundImage,false)
  721. ImgSetVisibility(ProgressBarImage,false)
  722. SetupButton:=BtnCreate(WizardForm.Handle,245,358,160,50,ExpandConstant('{tmp}\btn_complete_{language}.png'),1,False)
  723. BtnSetEvent(SetupButton,BtnClickEventID,WrapBtnCallback(@OnFinishButtonClick,1));
  724. BackgroundImage:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\bg_finish_{language}.png'),0,0,650,450,false,true);
  725. BtnSetEvent(CloseButton,BtnClickEventID,WrapBtnCallback(@OnSetupButtonClick,1));
  726. end;
  727. ImgApplyChanges(WizardForm.Handle)
  728. end;
  729. function ShouldSkipPage(PageID: Integer): Boolean;
  730. begin
  731. if (PageID=wpSelectComponents) or (PageID=wpSelectTasks) then //跳过组件安装界面
  732. begin
  733. result := true;
  734. end;
  735. end;