flyinsono_Lab_All.iss 28 KB

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