星火微课系统客户端
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 9.4KB

3 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. ; ű Inno Setup ű ɣ
  2. ; йش Inno Setup űļϸİĵ
  3. #define MyAppName "ǻ΢"
  4. #define MyAppDir "xhwk"
  5. #define MyAppVersion "3.1.12"
  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 KDetectSoft(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 := KDetectSoft('{#MyAppExeName}');
  94. Exit;
  95. end;
  96. Result:= true;
  97. end;
  98. // жʱر
  99. function InitializeUninstall(): Boolean;
  100. begin
  101. Result := KDetectSoft('{#MyAppExeName}');
  102. end;
  103. // Indicates whether the specified version and service pack of the .NET Framework is installed.
  104. //
  105. // version -- Specify one of these strings for the required .NET Framework version:
  106. // 'v1.1' .NET Framework 1.1
  107. // 'v2.0' .NET Framework 2.0
  108. // 'v3.0' .NET Framework 3.0
  109. // 'v3.5' .NET Framework 3.5
  110. // 'v4\Client' .NET Framework 4.0 Client Profile
  111. // 'v4\Full' .NET Framework 4.0 Full Installation
  112. // 'v4.5' .NET Framework 4.5
  113. // 'v4.5.1' .NET Framework 4.5.1
  114. // 'v4.5.2' .NET Framework 4.5.2
  115. // 'v4.6' .NET Framework 4.6
  116. // 'v4.6.1' .NET Framework 4.6.1
  117. // 'v4.6.2' .NET Framework 4.6.2
  118. // 'v4.7' .NET Framework 4.7
  119. // 'v4.7.1' .NET Framework 4.7.1
  120. // 'v4.7.2' .NET Framework 4.7.2
  121. // 'v4.8' .NET Framework 4.8
  122. //
  123. // service -- Specify any non-negative integer for the required service pack level:
  124. // 0 No service packs required
  125. // 1, 2, etc. Service pack 1, 2, etc. required
  126. function IsDotNetDetected(version: string; service: cardinal): boolean;
  127. var
  128. key, versionKey: string;
  129. install, release, serviceCount, versionRelease: cardinal;
  130. success: boolean;
  131. begin
  132. versionKey := version;
  133. versionRelease := 0;
  134. // .NET 1.1 and 2.0 embed release number in version key
  135. if version = 'v1.1' then begin
  136. versionKey := 'v1.1.4322';
  137. end
  138. else if version = 'v2.0' then begin
  139. versionKey := 'v2.0.50727';
  140. end
  141. // .NET 4.5 and newer install as update to .NET 4.0 Full
  142. else if Pos('v4.', version) = 1 then begin
  143. versionKey := 'v4\Full';
  144. case version of
  145. 'v4.5': versionRelease := 378389;
  146. 'v4.5.1': versionRelease := 378675; // 378758 on Windows 8 and older
  147. 'v4.5.2': versionRelease := 379893;
  148. 'v4.6': versionRelease := 393295; // 393297 on Windows 8.1 and older
  149. 'v4.6.1': versionRelease := 394254; // 394271 on Windows 8.1 and older
  150. 'v4.6.2': versionRelease := 394802; // 394806 on Windows 8.1 and older
  151. 'v4.7': versionRelease := 460798; // Windows 10
  152. 'v4.7.1': versionRelease := 461308; // Windows 10
  153. 'v4.7.2': versionRelease := 461808; // Windows 10
  154. 'v4.8' : versionRelease := 528040; // Windows 10
  155. end;
  156. end;
  157. // installation key group for all .NET versions
  158. key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + versionKey;
  159. // .NET 3.0 uses value InstallSuccess in subkey Setup
  160. if Pos('v3.0', version) = 1 then begin
  161. success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
  162. end else begin
  163. success := RegQueryDWordValue(HKLM, key, 'Install', install);
  164. end;
  165. // .NET 4.0 and newer use value Servicing instead of SP
  166. if Pos('v4', version) = 1 then begin
  167. success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
  168. end else begin
  169. success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
  170. end;
  171. // .NET 4.5 and newer use additional value Release
  172. if versionRelease > 0 then begin
  173. success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
  174. success := success and (release >= versionRelease);
  175. end;
  176. result := success and (install = 1) and (serviceCount >= service);
  177. end;
  178. function InitializeSetup: Boolean;
  179. var Path:string;
  180. ResultCode: Integer;
  181. begin
  182. if IsDotNetDetected('v4.5.2', 0) then
  183. begin
  184. if RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{01FAEC41-B3BC-44F4-B185-5E8475AEB855}', 'Version') then
  185. begin
  186. Result := true;
  187. end
  188. else
  189. begin
  190. if MsgBox('ϵͳ⵽ûаװVC++Ƿزװ', mbConfirmation, MB_YESNO) = idYes then
  191. begin
  192. Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');
  193. Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/VC_redist.x86.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
  194. MsgBox('밲װVC++бװ',mbInformation,MB_OK);
  195. Result := false;
  196. end
  197. else
  198. begin
  199. MsgBox('ȡֶװVC2015-2019',mbInformation,MB_OK);
  200. Result := true;
  201. end;
  202. end;
  203. end
  204. else
  205. begin
  206. if MsgBox('ϵͳ⵽ûаװ.Net Framework4.5.2Ƿزװ', mbConfirmation, MB_YESNO) = idYes then
  207. begin
  208. Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');
  209. Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/NDP452-KB2901907-x86-x64-AllOS-ENU.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
  210. MsgBox('밲װ.Net Frameworkбװ',mbInformation,MB_OK);
  211. Result := false;
  212. end
  213. else
  214. begin
  215. MsgBox('ûаװ.Net Framework޷г򣬱װ򼴽˳',mbInformation,MB_OK);
  216. Result := false;
  217. end;
  218. end;
  219. end;
  220. [CustomMessages]
  221. chinesesimp.checkSoftTip=װ⵽װУ%n%n"ȷ"ֹ"ȡ"