星火微课系统客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

星火微课-测试.iss 8.6KB

3 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. ; ű Inno Setup ű ɣ
  2. ; йش Inno Setup űļϸİĵ
  3. #define MyAppName "ǻ΢"
  4. #define MyAppDir "xhwk"
  5. #define MyAppVersion "3.1.13"
  6. #define MyAppPublisher "ǻԭƼ޹˾"
  7. #define MyAppURL "http://www.xhkjedu.com/"
  8. #define MySourcePath "D:\Project\CSharp\xhwkclient\XHWK.WKTool\bin\x86\Debug\"
  9. #define MyAppExeName "ǻ΢.exe"
  10. #define MyIcoName "256.ico"
  11. #define MyTargetPath "D:\\ǻ΢-\"
  12. [Setup]
  13. ; ע: AppIdֵΪʶӦó
  14. ; ҪΪװʹͬAppIdֵ
  15. ; (Ҫµ GUIDڲ˵е "| GUID")
  16. AppId={{5869900A-3BE4-463E-B0A6-462AA7454AE2}
  17. AppName={#MyAppName}
  18. AppVersion={#MyAppVersion}
  19. ;AppVerName={#MyAppName} {#MyAppVersion}
  20. AppPublisher={#MyAppPublisher}
  21. AppPublisherURL={#MyAppURL}
  22. AppSupportURL={#MyAppURL}
  23. AppUpdatesURL={#MyAppURL}
  24. DefaultDirName={autopf}\{#MyAppDir}
  25. DisableProgramGroupPage=yes
  26. ; [Icons] ġquicklaunchiconĿʹ {userappdata} [Tasks] Ŀʺ IsAdminInstallMode ļ顣
  27. UsedUserAreasWarning=no
  28. ; ȡעͣڷǹװģʽУΪǰûװ
  29. ;PrivilegesRequired=lowest
  30. OutputDir={#MyTargetPath}
  31. OutputBaseFilename="{#MyAppName} v{#MyAppVersion}"
  32. SetupIconFile="{#MySourcePath}{#MyIcoName}"
  33. Compression=lzma
  34. SolidCompression=yes
  35. WizardStyle=modern
  36. [Languages]
  37. Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"
  38. [Tasks]
  39. Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone
  40. Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode
  41. [Files]
  42. Source: "{#MySourcePath}{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
  43. Source: "{#MySourcePath}*"; Excludes: "ffmpeg.exe,\Log\*,\Temp,\Data";DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
  44. [Icons]
  45. Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
  46. Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
  47. Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
  48. [Run]
  49. Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
  50. [Code]
  51. // Զ庯жǷУΪҪжϵexe
  52. function CheckSoftRun(strExeName: String): Boolean;
  53. //
  54. var ErrorCode: Integer;
  55. var bRes: Boolean;
  56. var strFileContent: AnsiString;
  57. var strTmpPath: String; // ʱĿ¼
  58. var strTmpFile: String; // ʱļݽ
  59. var strCmdFind: String; //
  60. var strCmdKill: String; // ֹ
  61. begin
  62. strTmpPath := GetTempDir();
  63. strTmpFile := Format('%sfindSoftRes.txt', [strTmpPath]);
  64. strCmdFind := Format('/c tasklist /nh|find /c /i "%s" > "%s"', [strExeName, strTmpFile]);
  65. strCmdKill := Format('/c taskkill /f /t /im %s', [strExeName]);
  66. bRes := ShellExec('open', ExpandConstant('{cmd}'), strCmdFind, '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
  67. if bRes then begin
  68. bRes := LoadStringFromFile(strTmpFile, strFileContent);
  69. strFileContent := Trim(strFileContent);
  70. if bRes then begin
  71. if StrToInt(strFileContent) > 0 then begin
  72. if MsgBox(ExpandConstant('{cm:checkSoftTip}'), mbConfirmation, MB_OKCANCEL) = IDOK then begin
  73. // ֹ
  74. ShellExec('open', ExpandConstant('{cmd}'), strCmdKill, '', SW_HIDE, ewNoWait, ErrorCode);
  75. Result:= true;// װ
  76. end else begin
  77. Result:= false;// װ˳
  78. Exit;
  79. end;
  80. end else begin
  81. // û
  82. Result:= true;
  83. Exit;
  84. end;
  85. end;
  86. end;
  87. Result :=true;
  88. end;
  89. // ʼҳһʱжǷ
  90. function NextButtonClick(CurPageID: Integer): Boolean;
  91. begin
  92. if 1=CurPageID then begin
  93. Result := CheckSoftRun('{#MyAppExeName}');
  94. Exit;
  95. end;
  96. Result:= true;
  97. end;
  98. // жʱر
  99. function InitializeUninstall(): Boolean;
  100. begin
  101. Result := CheckSoftRun('{#MyAppExeName}');
  102. end;
  103. function CheckVC():boolean;
  104. var Path:string;
  105. ResultCode: Integer;
  106. begin
  107. if RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{01FAEC41-B3BC-44F4-B185-5E8475AEB855}', 'Version')
  108. or RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{77EB1EA9-8E1B-459D-8CDC-1984D0FF15B6}', 'Version')
  109. then
  110. begin
  111. Result := true;
  112. end
  113. else
  114. begin
  115. if MsgBox('ϵͳ⵽ûаװVC++Ƿزװ', mbConfirmation, MB_YESNO) = idYes then
  116. begin
  117. Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');
  118. Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/vc_redist.x86.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
  119. MsgBox('밲װVC++бװ',mbInformation,MB_OK);
  120. Result := false;
  121. end
  122. else
  123. begin
  124. MsgBox('ȡֶװVC2015-2019',mbInformation,MB_OK);
  125. Result := true;
  126. end;
  127. end;
  128. end;
  129. function IsInstallDotNet(version: string; service: cardinal): boolean;
  130. var
  131. key, versionKey: string;
  132. install, release, serviceCount, versionRelease: cardinal;
  133. success: boolean;
  134. begin
  135. versionKey := version;
  136. versionRelease := 0;
  137. // .NET 1.1 and 2.0 embed release number in version key
  138. if version = 'v1.1' then begin
  139. versionKey := 'v1.1.4322';
  140. end
  141. else if version = 'v2.0' then begin
  142. versionKey := 'v2.0.50727';
  143. end
  144. // .NET 4.5 and newer install as update to .NET 4.0 Full
  145. else if Pos('v4.', version) = 1 then begin
  146. versionKey := 'v4\Full';
  147. case version of
  148. 'v4.5': versionRelease := 378389;
  149. 'v4.5.1': versionRelease := 378675; // 378758 on Windows 8 and older
  150. 'v4.5.2': versionRelease := 379893;
  151. 'v4.6': versionRelease := 393295; // 393297 on Windows 8.1 and older
  152. 'v4.6.1': versionRelease := 394254; // 394271 on Windows 8.1 and older
  153. 'v4.6.2': versionRelease := 394802; // 394806 on Windows 8.1 and older
  154. 'v4.7': versionRelease := 460798; // Windows 10
  155. 'v4.7.1': versionRelease := 461308; // Windows 10
  156. 'v4.7.2': versionRelease := 461808; // Windows 10
  157. 'v4.8' : versionRelease := 528040; // Windows 10
  158. end;
  159. end;
  160. // installation key group for all .NET versions
  161. key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + versionKey;
  162. // .NET 3.0 uses value InstallSuccess in subkey Setup
  163. if Pos('v3.0', version) = 1 then begin
  164. success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
  165. end else begin
  166. success := RegQueryDWordValue(HKLM, key, 'Install', install);
  167. end;
  168. // .NET 4.0 and newer use value Servicing instead of SP
  169. if Pos('v4', version) = 1 then begin
  170. success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
  171. end else begin
  172. success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
  173. end;
  174. // .NET 4.5 and newer use additional value Release
  175. if versionRelease > 0 then begin
  176. success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
  177. success := success and (release >= versionRelease);
  178. end;
  179. result := success and (install = 1) and (serviceCount >= service);
  180. end;
  181. // .NetǷװ
  182. function CheckDotNet : Boolean;
  183. var Path:string;
  184. ResultCode: Integer;
  185. begin
  186. if IsInstallDotNet('v4.5.2', 0) then
  187. begin
  188. Result := true;
  189. end
  190. else
  191. begin
  192. if MsgBox('ϵͳ⵽ûаװ.Net Framework4.5.2Ƿزװ', mbConfirmation, MB_YESNO) = idYes then
  193. begin
  194. Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');
  195. Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/NDP452-KB2901907-x86-x64-AllOS-ENU.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
  196. MsgBox('밲װ.Net Frameworkбװ',mbInformation,MB_OK);
  197. Result := false;
  198. end
  199. else
  200. begin
  201. MsgBox('ûаװ.Net Framework޷г򣬱װ򼴽˳',mbInformation,MB_OK);
  202. Result := false;
  203. end;
  204. end;
  205. end;
  206. function InitializeSetup: Boolean;
  207. begin
  208. Result := CheckDotNet();
  209. Result := CheckVC();
  210. end;
  211. [CustomMessages]
  212. chinesesimp.checkSoftTip=װ⵽װУ%n%n"ȷ"ֹ"ȡ"